@@ -36,7 +36,7 @@ import {
3636} from '../../../src/app/index' ;
3737import {
3838 RefreshTokenCredential , ServiceAccountCredential ,
39- ComputeEngineCredential , getApplicationDefault , isApplicationDefault , ImpersonatedServiceAccountCredential
39+ getApplicationDefault , isApplicationDefault , ImpersonatedServiceAccountCredential , ApplicationDefaultCredential
4040} from '../../../src/app/credential-internal' ;
4141import { HttpClient } from '../../../src/utils/api-request' ;
4242import { Agent } from 'https' ;
@@ -332,7 +332,7 @@ describe('Credential', () => {
332332 const response = utils . responseFrom ( expected ) ;
333333 httpStub . resolves ( response ) ;
334334
335- const c = new ComputeEngineCredential ( ) ;
335+ const c = new ApplicationDefaultCredential ( ) ;
336336 return c . getAccessToken ( ) . then ( ( token ) => {
337337 expect ( token . access_token ) . to . equal ( 'anAccessToken' ) ;
338338 expect ( token . expires_in ) . to . equal ( 42 ) ;
@@ -350,7 +350,7 @@ describe('Credential', () => {
350350 const response = utils . responseFrom ( expected ) ;
351351 httpStub . resolves ( response ) ;
352352
353- const c = new ComputeEngineCredential ( ) ;
353+ const c = new ApplicationDefaultCredential ( ) ;
354354 return c . getIDToken ( 'my-audience.cloudfunctions.net' ) . then ( ( token ) => {
355355 expect ( token ) . to . equal ( expected ) ;
356356 expect ( httpStub ) . to . have . been . calledOnce . and . calledWith ( {
@@ -367,7 +367,7 @@ describe('Credential', () => {
367367 const response = utils . responseFrom ( expectedProjectId ) ;
368368 httpStub . resolves ( response ) ;
369369
370- const c = new ComputeEngineCredential ( ) ;
370+ const c = new ApplicationDefaultCredential ( ) ;
371371 return c . getProjectId ( ) . then ( ( projectId ) => {
372372 expect ( projectId ) . to . equal ( expectedProjectId ) ;
373373 expect ( httpStub ) . to . have . been . calledOnce . and . calledWith ( {
@@ -384,7 +384,7 @@ describe('Credential', () => {
384384 const response = utils . responseFrom ( expectedProjectId ) ;
385385 httpStub . resolves ( response ) ;
386386
387- const c = new ComputeEngineCredential ( ) ;
387+ const c = new ApplicationDefaultCredential ( ) ;
388388 return c . getProjectId ( )
389389 . then ( ( projectId ) => {
390390 expect ( projectId ) . to . equal ( expectedProjectId ) ;
@@ -404,7 +404,7 @@ describe('Credential', () => {
404404 it ( 'should reject when the metadata service is not available' , ( ) => {
405405 httpStub . rejects ( new FirebaseAppError ( 'network-error' , 'Failed to connect' ) ) ;
406406
407- const c = new ComputeEngineCredential ( ) ;
407+ const c = new ApplicationDefaultCredential ( ) ;
408408 return c . getProjectId ( ) . should . eventually
409409 . rejectedWith ( 'Failed to determine project ID: Failed to connect' )
410410 . and . have . property ( 'code' , 'app/invalid-credential' ) ;
@@ -414,7 +414,7 @@ describe('Credential', () => {
414414 const response = utils . errorFrom ( 'Unexpected error' ) ;
415415 httpStub . rejects ( response ) ;
416416
417- const c = new ComputeEngineCredential ( ) ;
417+ const c = new ApplicationDefaultCredential ( ) ;
418418 return c . getProjectId ( ) . should . eventually
419419 . rejectedWith ( 'Failed to determine project ID: Unexpected error' )
420420 . and . have . property ( 'code' , 'app/invalid-credential' ) ;
@@ -562,7 +562,7 @@ describe('Credential', () => {
562562 it ( 'should return a MetadataServiceCredential as a last resort' , ( ) => {
563563 delete process . env . GOOGLE_APPLICATION_CREDENTIALS ;
564564 fsStub = sinon . stub ( fs , 'readFileSync' ) . throws ( new Error ( 'no gcloud credential file' ) ) ;
565- expect ( getApplicationDefault ( ) ) . to . be . an . instanceof ( ComputeEngineCredential ) ;
565+ expect ( getApplicationDefault ( ) ) . to . be . an . instanceof ( ApplicationDefaultCredential ) ;
566566 } ) ;
567567
568568 it ( 'should create access tokens' , ( ) => {
@@ -653,7 +653,7 @@ describe('Credential', () => {
653653 delete process . env . GOOGLE_APPLICATION_CREDENTIALS ;
654654 fsStub = sinon . stub ( fs , 'readFileSync' ) . throws ( new Error ( 'no gcloud credential file' ) ) ;
655655 const c = getApplicationDefault ( ) ;
656- expect ( c ) . to . be . an . instanceof ( ComputeEngineCredential ) ;
656+ expect ( c ) . to . be . an . instanceof ( ApplicationDefaultCredential ) ;
657657 expect ( isApplicationDefault ( c ) ) . to . be . true ;
658658 } ) ;
659659
@@ -720,7 +720,7 @@ describe('Credential', () => {
720720
721721 it ( 'ComputeEngineCredential should use the provided HTTP Agent' , ( ) => {
722722 const agent = new Agent ( ) ;
723- const c = new ComputeEngineCredential ( agent ) ;
723+ const c = new ApplicationDefaultCredential ( agent ) ;
724724 return c . getAccessToken ( ) . then ( ( token ) => {
725725 expect ( token . access_token ) . to . equal ( expectedToken ) ;
726726 expect ( stub ) . to . have . been . calledOnce ;
0 commit comments