diff options
| author | matt korwel <[email protected]> | 2025-07-09 21:51:37 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-09 21:51:37 -0700 |
| commit | 58607b92dfe76dd657338b5433d0fd33800f9272 (patch) | |
| tree | 4a07182ca01f20074a5544db5caf5a198cabae6c /packages/core/src/code_assist/oauth2.test.ts | |
| parent | b7f8e1360fc13c077c24c98fe9d85e0734195000 (diff) | |
Revert "fix: Use Email for Clearcut Logging and Refactor User Info Fetching" (#3744)
Diffstat (limited to 'packages/core/src/code_assist/oauth2.test.ts')
| -rw-r--r-- | packages/core/src/code_assist/oauth2.test.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/packages/core/src/code_assist/oauth2.test.ts b/packages/core/src/code_assist/oauth2.test.ts index 58081e6a..76d43726 100644 --- a/packages/core/src/code_assist/oauth2.test.ts +++ b/packages/core/src/code_assist/oauth2.test.ts @@ -61,11 +61,30 @@ describe('oauth2', () => { const mockGetAccessToken = vi .fn() .mockResolvedValue({ token: 'mock-access-token' }); + const mockRefreshAccessToken = vi.fn().mockImplementation((callback) => { + // Mock the callback-style refreshAccessToken method + const mockTokensWithIdToken = { + access_token: 'test-access-token', + refresh_token: 'test-refresh-token', + id_token: + 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ0ZXN0LWdvb2dsZS1hY2NvdW50LWlkLTEyMyJ9.signature', // Mock JWT with sub: test-google-account-id-123 + }; + callback(null, mockTokensWithIdToken); + }); + const mockVerifyIdToken = vi.fn().mockResolvedValue({ + getPayload: () => ({ + sub: 'test-google-account-id-123', + aud: 'test-audience', + iss: 'https://accounts.google.com', + }), + }); const mockOAuth2Client = { generateAuthUrl: mockGenerateAuthUrl, getToken: mockGetToken, setCredentials: mockSetCredentials, getAccessToken: mockGetAccessToken, + refreshAccessToken: mockRefreshAccessToken, + verifyIdToken: mockVerifyIdToken, credentials: mockTokens, on: vi.fn(), } as unknown as OAuth2Client; |
