@@ -2,7 +2,6 @@ import { Scorer } from '../../src/sdk/scorer';
22import type {
33 ScorerRetrieveResponse ,
44 ScorerUpdateResponse ,
5- ScorerValidateResponse ,
65} from '../../src/resources/scenarios/scorers' ;
76
87// Mock the Runloop client
@@ -11,7 +10,6 @@ jest.mock('../../src/index');
1110describe ( 'Scorer' , ( ) => {
1211 let mockClient : any ;
1312 let mockScorerData : ScorerRetrieveResponse ;
14- let mockValidateResult : ScorerValidateResponse ;
1513
1614 beforeEach ( ( ) => {
1715 mockClient = {
@@ -20,7 +18,6 @@ describe('Scorer', () => {
2018 create : jest . fn ( ) ,
2119 retrieve : jest . fn ( ) ,
2220 update : jest . fn ( ) ,
23- validate : jest . fn ( ) ,
2421 list : jest . fn ( ) ,
2522 } ,
2623 } ,
@@ -32,16 +29,6 @@ describe('Scorer', () => {
3229 bash_script : 'echo "1.0"' ,
3330 } ;
3431
35- mockValidateResult = {
36- name : 'my_custom_scorer' ,
37- scoring_context : { output : 'test' } ,
38- scoring_result : {
39- output : '1.0' ,
40- score : 1.0 ,
41- state : 'complete' ,
42- scoring_function_name : 'test-scorer' ,
43- } ,
44- } ;
4532 } ) ;
4633
4734 describe ( 'fromId' , ( ) => {
@@ -188,38 +175,6 @@ describe('Scorer', () => {
188175 } ) ;
189176 } ) ;
190177
191- describe ( 'validate' , ( ) => {
192- it ( 'should validate scorer with scoring context' , async ( ) => {
193- mockClient . scenarios . scorers . validate . mockResolvedValue ( mockValidateResult ) ;
194-
195- const scorer = Scorer . fromId ( mockClient , 'scs_123' ) ;
196- const result = await scorer . validate ( {
197- scoring_context : { output : 'test output' , expected : 'expected output' } ,
198- } ) ;
199-
200- expect ( mockClient . scenarios . scorers . validate ) . toHaveBeenCalledWith (
201- 'scs_123' ,
202- { scoring_context : { output : 'test output' , expected : 'expected output' } } ,
203- undefined ,
204- ) ;
205- expect ( result . scoring_result . score ) . toBe ( 1.0 ) ;
206- expect ( result . scoring_result . output ) . toBe ( '1.0' ) ;
207- } ) ;
208-
209- it ( 'should pass options to the API client' , async ( ) => {
210- mockClient . scenarios . scorers . validate . mockResolvedValue ( mockValidateResult ) ;
211-
212- const scorer = Scorer . fromId ( mockClient , 'scs_123' ) ;
213- await scorer . validate ( { scoring_context : { } } , { timeout : 30000 } ) ;
214-
215- expect ( mockClient . scenarios . scorers . validate ) . toHaveBeenCalledWith (
216- 'scs_123' ,
217- { scoring_context : { } } ,
218- { timeout : 30000 } ,
219- ) ;
220- } ) ;
221- } ) ;
222-
223178 describe ( 'error handling' , ( ) => {
224179 it ( 'should handle API errors on getInfo' , async ( ) => {
225180 const error = new Error ( 'Scorer not found' ) ;
@@ -241,13 +196,5 @@ describe('Scorer', () => {
241196 ) ;
242197 } ) ;
243198
244- it ( 'should handle API errors on validate' , async ( ) => {
245- const error = new Error ( 'Validation timeout' ) ;
246- mockClient . scenarios . scorers . validate . mockRejectedValue ( error ) ;
247-
248- const scorer = Scorer . fromId ( mockClient , 'scs_123' ) ;
249-
250- await expect ( scorer . validate ( { scoring_context : { } } ) ) . rejects . toThrow ( 'Validation timeout' ) ;
251- } ) ;
252199 } ) ;
253200} ) ;
0 commit comments