diff options
| author | Yuki Okita <[email protected]> | 2025-08-20 10:55:47 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-20 01:55:47 +0000 |
| commit | 21c6480b65528a98ac0e1e3855f3c78c1f9b7cbe (patch) | |
| tree | 5555ec429209e87e0c21483c9e5fddd53ac01dbc /packages/core/src/code_assist/oauth2.test.ts | |
| parent | 1049d388451120587a8643a401fd71430a8cd5fe (diff) | |
Refac: Centralize storage file management (#4078)
Co-authored-by: Taylor Mullen <[email protected]>
Diffstat (limited to 'packages/core/src/code_assist/oauth2.test.ts')
| -rw-r--r-- | packages/core/src/code_assist/oauth2.test.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/packages/core/src/code_assist/oauth2.test.ts b/packages/core/src/code_assist/oauth2.test.ts index 4334bd36..a90bde1b 100644 --- a/packages/core/src/code_assist/oauth2.test.ts +++ b/packages/core/src/code_assist/oauth2.test.ts @@ -11,7 +11,7 @@ import { clearCachedCredentialFile, clearOauthClientCache, } from './oauth2.js'; -import { getCachedGoogleAccount } from '../utils/user_account.js'; +import { UserAccountManager } from '../utils/userAccountManager.js'; import { OAuth2Client, Compute } from 'google-auth-library'; import * as fs from 'fs'; import * as path from 'path'; @@ -180,7 +180,10 @@ describe('oauth2', () => { }); // Verify the getCachedGoogleAccount function works - expect(getCachedGoogleAccount()).toBe('[email protected]'); + const userAccountManager = new UserAccountManager(); + expect(userAccountManager.getCachedGoogleAccount()).toBe( + '[email protected]', + ); }); it('should perform login with user code', async () => { @@ -533,14 +536,17 @@ describe('oauth2', () => { googleAccountPath, JSON.stringify(accountData), ); + const userAccountManager = new UserAccountManager(); expect(fs.existsSync(credsPath)).toBe(true); expect(fs.existsSync(googleAccountPath)).toBe(true); - expect(getCachedGoogleAccount()).toBe('[email protected]'); + expect(userAccountManager.getCachedGoogleAccount()).toBe( + '[email protected]', + ); await clearCachedCredentialFile(); expect(fs.existsSync(credsPath)).toBe(false); - expect(getCachedGoogleAccount()).toBeNull(); + expect(userAccountManager.getCachedGoogleAccount()).toBeNull(); const updatedAccountData = JSON.parse( fs.readFileSync(googleAccountPath, 'utf-8'), ); |
