1010 * - CI/CD: OAuth S2S with IMS_CLIENT_ID and IMS_CLIENT_SECRET
1111 * - Local: Adobe I/O CLI (aio auth login --bare)
1212 *
13- * Run with: npm run test:query
13+ * Run with: npm run test:e2e
1414 */
1515
16- import dotenv from 'dotenv' ;
17- import { fileURLToPath } from 'url' ;
18- import { dirname , join } from 'path' ;
19- import {
20- describe , test , expect , beforeAll ,
21- } from '@jest/globals' ;
22- import { ImsHelper } from '../utils/imsHelper.js' ;
23- import makeQuery from '../utils/queryHelper.js' ;
16+ import * as dotenv from 'dotenv' ;
17+ import * as path from 'path' ;
18+ import { ImsHelper } from '../utils/imsHelper' ;
19+ import makeQuery from '../utils/queryHelper' ;
2420
2521// Load environment variables
26- const __filename = fileURLToPath ( import . meta. url ) ;
27- const __dirname = dirname ( __filename ) ;
28- dotenv . config ( { path : join ( __dirname , '..' , '.env' ) } ) ;
22+ dotenv . config ( { path : path . join ( __dirname , '..' , '.env' ) } ) ;
2923
3024// IMS Token - fetched dynamically via OAuth (CI/CD) or aio CLI (local)
3125// NOT stored in .env file for security reasons
@@ -37,7 +31,7 @@ describe('Query Endpoint E2E Tests', () => {
3731 try {
3832 VALID_IMS_TOKEN = await imsHelper . getToken ( ) ;
3933 console . log ( 'Valid IMS token obtained for testing' ) ;
40- } catch ( error ) {
34+ } catch ( error : any ) {
4135 console . error ( 'Failed to fetch IMS token:' , error . message ) ;
4236 }
4337 } , 30000 ) ; // 30 second timeout for token fetch
@@ -192,14 +186,14 @@ describe('Query Endpoint E2E Tests', () => {
192186
193187 // Should return results, but with low relevance scores
194188 if ( data . results . length > 0 ) {
195- const avgScore = data . results . reduce ( ( sum , r ) => sum + r . score , 0 ) / data . results . length ;
189+ const avgScore = data . results . reduce ( ( sum : number , r : any ) => sum + r . score , 0 ) / data . results . length ;
196190
197191 // Log for visibility
198192 console . log ( `Invalid context query - avg score: ${ avgScore . toFixed ( 4 ) } ` ) ;
199193 console . log ( `Results returned: ${ data . results . length } ` ) ;
200194
201195 // Results should have lower relevance scores (typically < 0.5 for unrelated content)
202- data . results . forEach ( ( result , idx ) => {
196+ data . results . forEach ( ( result : any , idx : number ) => {
203197 console . log ( `Result ${ idx + 1 } score: ${ result . score . toFixed ( 4 ) } ` ) ;
204198 } ) ;
205199 } else {
@@ -227,3 +221,4 @@ describe('Query Endpoint E2E Tests', () => {
227221 } ) ;
228222 } ) ;
229223} ) ;
224+
0 commit comments