@@ -26,6 +26,7 @@ import * as utils from '../utils';
2626import * as mocks from '../../resources/mocks' ;
2727
2828import { InstanceId } from '../../../src/instance-id/instance-id' ;
29+ import { InstanceIdImpl } from '../../../src/instance-id/instance-id-internal' ;
2930import { FirebaseInstanceIdRequestHandler } from '../../../src/instance-id/instance-id-request' ;
3031import { FirebaseApp } from '../../../src/firebase-app' ;
3132import { FirebaseInstanceIdError , InstanceIdClientErrorCode } from '../../../src/utils/error' ;
@@ -57,14 +58,14 @@ describe('InstanceId', () => {
5758 mockApp = mocks . app ( ) ;
5859 getTokenStub = utils . stubGetAccessToken ( undefined , mockApp ) ;
5960 mockCredentialApp = mocks . mockCredentialApp ( ) ;
60- iid = new InstanceId ( mockApp ) ;
61+ iid = new InstanceIdImpl ( mockApp ) ;
6162
6263 googleCloudProject = process . env . GOOGLE_CLOUD_PROJECT ;
6364 gcloudProject = process . env . GCLOUD_PROJECT ;
6465
65- nullAccessTokenClient = new InstanceId ( mocks . appReturningNullAccessToken ( ) ) ;
66- malformedAccessTokenClient = new InstanceId ( mocks . appReturningMalformedAccessToken ( ) ) ;
67- rejectedPromiseAccessTokenClient = new InstanceId ( mocks . appRejectedWhileFetchingAccessToken ( ) ) ;
66+ nullAccessTokenClient = new InstanceIdImpl ( mocks . appReturningNullAccessToken ( ) ) ;
67+ malformedAccessTokenClient = new InstanceIdImpl ( mocks . appReturningMalformedAccessToken ( ) ) ;
68+ rejectedPromiseAccessTokenClient = new InstanceIdImpl ( mocks . appRejectedWhileFetchingAccessToken ( ) ) ;
6869 } ) ;
6970
7071 afterEach ( ( ) => {
@@ -80,15 +81,15 @@ describe('InstanceId', () => {
8081 invalidApps . forEach ( ( invalidApp ) => {
8182 it ( 'should throw given invalid app: ' + JSON . stringify ( invalidApp ) , ( ) => {
8283 expect ( ( ) => {
83- const iidAny : any = InstanceId ;
84+ const iidAny : any = InstanceIdImpl ;
8485 return new iidAny ( invalidApp ) ;
8586 } ) . to . throw ( 'First argument passed to admin.instanceId() must be a valid Firebase app instance.' ) ;
8687 } ) ;
8788 } ) ;
8889
8990 it ( 'should throw given no app' , ( ) => {
9091 expect ( ( ) => {
91- const iidAny : any = InstanceId ;
92+ const iidAny : any = InstanceIdImpl ;
9293 return new iidAny ( ) ;
9394 } ) . to . throw ( 'First argument passed to admin.instanceId() must be a valid Firebase app instance.' ) ;
9495 } ) ;
@@ -97,14 +98,14 @@ describe('InstanceId', () => {
9798 // Project ID not set in the environment.
9899 delete process . env . GOOGLE_CLOUD_PROJECT ;
99100 delete process . env . GCLOUD_PROJECT ;
100- const instanceId = new InstanceId ( mockCredentialApp ) ;
101+ const instanceId = new InstanceIdImpl ( mockCredentialApp ) ;
101102 return instanceId . deleteInstanceId ( 'iid' )
102103 . should . eventually . rejectedWith ( noProjectIdError ) ;
103104 } ) ;
104105
105106 it ( 'should not throw given a valid app' , ( ) => {
106107 expect ( ( ) => {
107- return new InstanceId ( mockApp ) ;
108+ return new InstanceIdImpl ( mockApp ) ;
108109 } ) . not . to . throw ( ) ;
109110 } ) ;
110111 } ) ;
@@ -118,7 +119,7 @@ describe('InstanceId', () => {
118119 it ( 'is read-only' , ( ) => {
119120 expect ( ( ) => {
120121 ( iid as any ) . app = mockApp ;
121- } ) . to . throw ( 'Cannot set property app of #<InstanceId > which has only a getter' ) ;
122+ } ) . to . throw ( 'Cannot set property app of #<InstanceIdImpl > which has only a getter' ) ;
122123 } ) ;
123124 } ) ;
124125
0 commit comments