@@ -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 } ) ;
@@ -141,7 +144,7 @@ describe('Top level API', () => {
141144 expect ( log . severityNumber ) . to . equal ( SeverityNumber . ERROR ) ;
142145 expect ( log . body ) . to . equal ( 'error with no stack' ) ;
143146 expect ( log . attributes ) . to . deep . equal ( {
144- 'user.id' : 'fid-1234' ,
147+ 'user.id' : FID ,
145148 'error.type' : 'Error' ,
146149 'error.stack' : 'No stack trace available'
147150 } ) ;
@@ -192,7 +195,7 @@ describe('Top level API', () => {
192195 await provider . shutdown ( ) ;
193196
194197 expect ( emittedLogs [ 0 ] . attributes ) . to . deep . equal ( {
195- 'user.id' : 'fid-1234' ,
198+ 'user.id' : FID ,
196199 'error.type' : 'TestError' ,
197200 'error.stack' : '...stack trace...' ,
198201 'logging.googleapis.com/trace' : `projects/${ PROJECT_ID } /traces/my-trace` ,
@@ -217,7 +220,7 @@ describe('Top level API', () => {
217220 expect ( emittedLogs . length ) . to . equal ( 1 ) ;
218221 const log = emittedLogs [ 0 ] ;
219222 expect ( log . attributes ) . to . deep . equal ( {
220- 'user.id' : 'fid-1234' ,
223+ 'user.id' : FID ,
221224 'error.type' : 'TestError' ,
222225 'error.stack' : '...stack trace...' ,
223226 strAttr : 'string attribute' ,
@@ -250,10 +253,10 @@ function getFakeApp(): FirebaseApp {
250253 new Component (
251254 'installations-internal' ,
252255 ( ) => ( {
253- getId : ( ) => Promise . resolve ( 'fid-1234' ) ,
254- getToken : ( ) => Promise . resolve ( 'token-5678' )
255- } ) ,
256- ComponentType . PRIVATE
256+ getId : async ( ) => 'FID' ,
257+ getToken : async ( ) => 'authToken'
258+ } ) as _FirebaseInstallationsInternal ,
259+ ComponentType . PUBLIC
257260 )
258261 ) ;
259262 _registerComponent (
@@ -265,7 +268,11 @@ function getFakeApp(): FirebaseApp {
265268 ComponentType . PUBLIC
266269 )
267270 ) ;
268- const app = initializeApp ( { } ) ;
271+ const app = initializeApp ( {
272+ projectId : PROJECT_ID ,
273+ appId : APP_ID ,
274+ apiKey : API_KEY
275+ } ) ;
269276 _addOrOverwriteComponent (
270277 app ,
271278 //@ts -ignore
0 commit comments