@@ -37,9 +37,12 @@ import { FirebaseAppCheckInternal } from '@firebase/app-check-interop-types';
3737import { captureError , flush , getTelemetry } from './api' ;
3838import { TelemetryService } from './service' ;
3939import { registerTelemetry } from './register' ;
40+ import { _FirebaseInstallationsInternal } from '@firebase/installations' ;
4041
4142const PROJECT_ID = 'my-project' ;
4243const APP_ID = 'my-appid' ;
44+ const API_KEY = 'my-api-key' ;
45+ const FID = 'fid-1234' ;
4346
4447const emittedLogs : LogRecord [ ] = [ ] ;
4548
@@ -68,7 +71,7 @@ const fakeTelemetry: Telemetry = {
6871 }
6972 } ,
7073 loggerProvider : fakeLoggerProvider ,
71- fid : 'fid-1234'
74+ fid : FID
7275} ;
7376
7477describe ( 'Top level API' , ( ) => {
@@ -124,7 +127,7 @@ describe('Top level API', () => {
124127 expect ( log . severityNumber ) . to . equal ( SeverityNumber . ERROR ) ;
125128 expect ( log . body ) . to . equal ( 'This is a test error' ) ;
126129 expect ( log . attributes ) . to . deep . equal ( {
127- 'user.id' : 'fid-1234' ,
130+ 'user.id' : FID ,
128131 'error.type' : 'TestError' ,
129132 'error.stack' : '...stack trace...' ,
130133 'app.version' : 'unset'
@@ -142,7 +145,7 @@ describe('Top level API', () => {
142145 expect ( log . severityNumber ) . to . equal ( SeverityNumber . ERROR ) ;
143146 expect ( log . body ) . to . equal ( 'error with no stack' ) ;
144147 expect ( log . attributes ) . to . deep . equal ( {
145- 'user.id' : 'fid-1234' ,
148+ 'user.id' : FID ,
146149 'error.type' : 'Error' ,
147150 'error.stack' : 'No stack trace available' ,
148151 'app.version' : 'unset'
@@ -194,7 +197,7 @@ describe('Top level API', () => {
194197 await provider . shutdown ( ) ;
195198
196199 expect ( emittedLogs [ 0 ] . attributes ) . to . deep . equal ( {
197- 'user.id' : 'fid-1234' ,
200+ 'user.id' : FID ,
198201 'error.type' : 'TestError' ,
199202 'error.stack' : '...stack trace...' ,
200203 'app.version' : 'unset' ,
@@ -220,7 +223,7 @@ describe('Top level API', () => {
220223 expect ( emittedLogs . length ) . to . equal ( 1 ) ;
221224 const log = emittedLogs [ 0 ] ;
222225 expect ( log . attributes ) . to . deep . equal ( {
223- 'user.id' : 'fid-1234' ,
226+ 'user.id' : FID ,
224227 'error.type' : 'TestError' ,
225228 'error.stack' : '...stack trace...' ,
226229 'app.version' : 'unset' ,
@@ -272,10 +275,10 @@ function getFakeApp(): FirebaseApp {
272275 new Component (
273276 'installations-internal' ,
274277 ( ) => ( {
275- getId : ( ) => Promise . resolve ( 'fid-1234' ) ,
276- getToken : ( ) => Promise . resolve ( 'token-5678' )
277- } ) ,
278- ComponentType . PRIVATE
278+ getId : async ( ) => 'FID' ,
279+ getToken : async ( ) => 'authToken'
280+ } ) as _FirebaseInstallationsInternal ,
281+ ComponentType . PUBLIC
279282 )
280283 ) ;
281284 _registerComponent (
@@ -287,7 +290,11 @@ function getFakeApp(): FirebaseApp {
287290 ComponentType . PUBLIC
288291 )
289292 ) ;
290- const app = initializeApp ( { } ) ;
293+ const app = initializeApp ( {
294+ projectId : PROJECT_ID ,
295+ appId : APP_ID ,
296+ apiKey : API_KEY
297+ } ) ;
291298 _addOrOverwriteComponent (
292299 app ,
293300 //@ts -ignore
0 commit comments