@@ -16,10 +16,9 @@ const describeIntegration = API_KEY ? describe : describe.skip
1616 * Use undici's fetch directly to bypass the global fetch mock set up in vitest.setup.ts.
1717 */
1818async function liveFetch ( url : string , init : RequestInit ) : Promise < Response > {
19- // vi.mocked(fetch) is the mock — call the real underlying impl
2019 const { request } = await import ( 'undici' )
2120 const resp = await request ( url , {
22- method : init . method as any ,
21+ method : init . method as 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' ,
2322 headers : init . headers as Record < string , string > ,
2423 body : init . body as string ,
2524 } )
@@ -359,7 +358,11 @@ describeIntegration('VoyageAI Integration Tests (live API)', () => {
359358 } , 15000 )
360359
361360 it ( 'should reject invalid API key' , async ( ) => {
362- const headers = rerankTool . request . headers ( { apiKey : 'invalid-key' , query : '' , documents : [ ] } )
361+ const headers = rerankTool . request . headers ( {
362+ apiKey : 'invalid-key' ,
363+ query : '' ,
364+ documents : [ ] ,
365+ } )
363366 const body = rerankTool . request . body ! ( {
364367 apiKey : 'invalid-key' ,
365368 query : 'test' ,
@@ -416,7 +419,11 @@ describeIntegration('VoyageAI Integration Tests (live API)', () => {
416419 query : 'What are neural networks used for?' ,
417420 documents,
418421 } )
419- const rerankHeaders = rerankTool . request . headers ( { apiKey : API_KEY ! , query : '' , documents : [ ] } )
422+ const rerankHeaders = rerankTool . request . headers ( {
423+ apiKey : API_KEY ! ,
424+ query : '' ,
425+ documents : [ ] ,
426+ } )
420427 const rerankUrl =
421428 typeof rerankTool . request . url === 'function'
422429 ? rerankTool . request . url ( { apiKey : API_KEY ! , query : '' , documents : [ ] } )
@@ -451,7 +458,9 @@ describeIntegration('VoyageAI Integration Tests (live API)', () => {
451458
452459 // The AI-related docs should score higher than the unrelated ones
453460 const aiDocIndices = [ 0 , 2 ] // "Neural networks..." and "Deep learning..."
454- const topTwoIndices = rerankResult . output . results . slice ( 0 , 2 ) . map ( ( r : any ) => r . index )
461+ const topTwoIndices = rerankResult . output . results
462+ . slice ( 0 , 2 )
463+ . map ( ( r : { index : number } ) => r . index )
455464 const aiDocsInTop2 = topTwoIndices . filter ( ( i : number ) => aiDocIndices . includes ( i ) )
456465 expect ( aiDocsInTop2 . length ) . toBeGreaterThanOrEqual ( 1 )
457466 } , 30000 )
0 commit comments