@@ -6,9 +6,11 @@ import * as gif from "../../../../src/gemini/fdcExperience";
66import { dataConnectConfigs } from "../../data-connect/config" ;
77import { ResultValue } from "../../result" ;
88import { registerExecution } from "../../data-connect/execution/execution" ;
9+ import { requireAuthWrapper } from "../../cli" ;
910import * as auth from "../../../../src/auth" ;
10- import * as nock from "nock" ;
11+ import nock from "../../../../src/test/helpers/ nock" ;
1112import { setAccessToken } from "../../../../src/apiv2" ;
13+ import { googleOrigin } from "../../../../src/api" ;
1214import { configstore } from "../../../../src/configstore" ;
1315
1416firebaseSuite (
@@ -19,15 +21,21 @@ firebaseSuite(
1921 let authStub : any ;
2022 let executionDisposable : vscode . Disposable ;
2123
22- setup ( ( ) => {
24+ setup ( async ( ) => {
25+ nock . cleanAll ( ) ;
2326 showErrorMessageStub = stub ( vscode . window , "showErrorMessage" ) ;
2427 showInformationMessageStub = stub (
2528 vscode . window ,
2629 "showInformationMessage" ,
2730 ) ;
28- authStub = stub ( auth , "getAccessToken" ) . resolves ( {
29- access_token : "an_access_token" ,
30- } ) ;
31+ process . env . FIREBASE_TOKEN = "mock_refresh_token" ;
32+ nock ( googleOrigin ( ) )
33+ . post ( "/oauth2/v3/token" )
34+ . reply ( 200 , {
35+ access_token : "an_access_token" ,
36+ expires_in : 3600 ,
37+ } ) ;
38+ await requireAuthWrapper ( false ) ;
3139 setAccessToken ( "an_access_token" ) ;
3240
3341 stub ( vscode . window , "withProgress" ) . callsFake ( async ( options , task ) => {
@@ -72,11 +80,10 @@ firebaseSuite(
7280 analyticsLogger ,
7381 emulatorsController ,
7482 ) ;
75-
76- nock . cleanAll ( ) ;
7783 } ) ;
7884
7985 teardown ( ( ) => {
86+ delete process . env . FIREBASE_TOKEN ;
8087 executionDisposable . dispose ( ) ;
8188 restore ( ) ;
8289 nock . cleanAll ( ) ;
0 commit comments