diff options
| author | Gaurav <[email protected]> | 2025-07-09 21:17:40 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-10 04:17:40 +0000 |
| commit | b7f8e1360fc13c077c24c98fe9d85e0734195000 (patch) | |
| tree | 09bad91a13c35017b4c02fab6169c151e24adb68 /packages/core/src/utils/user_id.test.ts | |
| parent | da50a1eefbd0751aaf137882595d500e6b6b4179 (diff) | |
fix: Use Email for Clearcut Logging and Refactor User Info Fetching (#3620)
Diffstat (limited to 'packages/core/src/utils/user_id.test.ts')
| -rw-r--r-- | packages/core/src/utils/user_id.test.ts | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/packages/core/src/utils/user_id.test.ts b/packages/core/src/utils/user_id.test.ts index 185d6c95..42d8958c 100644 --- a/packages/core/src/utils/user_id.test.ts +++ b/packages/core/src/utils/user_id.test.ts @@ -5,7 +5,7 @@ */ import { describe, it, expect } from 'vitest'; -import { getInstallationId, getGoogleAccountId } from './user_id.js'; +import { getInstallationId, getGoogleAccountEmail } from './user_id.js'; describe('user_id', () => { describe('getInstallationId', () => { @@ -22,30 +22,24 @@ describe('user_id', () => { }); }); - describe('getGoogleAccountId', () => { - it('should return a non-empty string', async () => { - const result = await getGoogleAccountId(); + describe('getGoogleAccountEmail', () => { + it('should return a non-empty string', () => { + const result = getGoogleAccountEmail(); expect(result).toBeDefined(); expect(typeof result).toBe('string'); // Should be consistent on subsequent calls - const secondCall = await getGoogleAccountId(); + const secondCall = getGoogleAccountEmail(); expect(secondCall).toBe(result); }); - it('should return empty string when no Google Account ID is cached, or a valid ID when cached', async () => { - // The function can return either an empty string (if no cached ID) or a valid Google Account ID (if cached) - const googleAccountIdResult = await getGoogleAccountId(); + it('should return empty string when no Google Account email is cached', () => { + // In a clean test environment, there should be no cached Google Account email + const googleAccountEmailResult = getGoogleAccountEmail(); - expect(googleAccountIdResult).toBeDefined(); - expect(typeof googleAccountIdResult).toBe('string'); - - // Should be either empty string or a numeric string (Google Account ID) - if (googleAccountIdResult !== '') { - // If we have a cached ID, it should be a numeric string - expect(googleAccountIdResult).toMatch(/^\d+$/); - } + // They should be the same when no Google Account email is cached + expect(googleAccountEmailResult).toBe(''); }); }); }); |
