1616 */
1717
1818import { expect , use } from 'chai' ;
19- import { restore , stub } from 'sinon' ;
19+ import { match , restore , stub } from 'sinon' ;
2020import sinonChai from 'sinon-chai' ;
2121import chaiAsPromised from 'chai-as-promised' ;
2222import { RequestUrl , Task , getHeaders , makeRequest } from './request' ;
@@ -25,6 +25,7 @@ import { DEFAULT_API_VERSION } from '../constants';
2525import { VertexAIErrorCode } from '../types' ;
2626import { VertexAIError } from '../errors' ;
2727import { getMockResponse } from '../../test-utils/mock-response' ;
28+ import { base64 } from '@firebase/util' ;
2829
2930use ( sinonChai ) ;
3031use ( chaiAsPromised ) ;
@@ -169,13 +170,18 @@ describe('request methods', () => {
169170 project : 'myproject' ,
170171 location : 'moon' ,
171172 getAppCheckToken : ( ) =>
172- Promise . resolve ( { token : 'token ' , error : Error ( 'oops' ) } )
173+ Promise . resolve ( { token : 'dummytoken ' , error : Error ( 'oops' ) } )
173174 } ,
174175 true ,
175176 { }
176177 ) ;
178+ const warnStub = stub ( console , 'warn' ) ;
177179 const headers = await getHeaders ( fakeUrl ) ;
178- expect ( headers . has ( 'X-Firebase-AppCheck' ) ) . to . be . false ;
180+ expect ( headers . get ( 'X-Firebase-AppCheck' ) ) . to . equal ( 'dummytoken' ) ;
181+ expect ( warnStub ) . to . be . calledWith (
182+ match ( / v e r t e x a i / ) ,
183+ match ( / A p p C h e c k .* o o p s / )
184+ ) ;
179185 } ) ;
180186 it ( 'adds auth token if it exists' , async ( ) => {
181187 const headers = await getHeaders ( fakeUrl ) ;
0 commit comments