mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 01:07:46 +00:00
Revert "fix: Use Email for Clearcut Logging and Refactor User Info Fetching" (#3744)
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { getInstallationId, getGoogleAccountEmail } from './user_id.js';
|
||||
import { getInstallationId, getGoogleAccountId } from './user_id.js';
|
||||
|
||||
describe('user_id', () => {
|
||||
describe('getInstallationId', () => {
|
||||
@@ -22,24 +22,30 @@ describe('user_id', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getGoogleAccountEmail', () => {
|
||||
it('should return a non-empty string', () => {
|
||||
const result = getGoogleAccountEmail();
|
||||
describe('getGoogleAccountId', () => {
|
||||
it('should return a non-empty string', async () => {
|
||||
const result = await getGoogleAccountId();
|
||||
|
||||
expect(result).toBeDefined();
|
||||
expect(typeof result).toBe('string');
|
||||
|
||||
// Should be consistent on subsequent calls
|
||||
const secondCall = getGoogleAccountEmail();
|
||||
const secondCall = await getGoogleAccountId();
|
||||
expect(secondCall).toBe(result);
|
||||
});
|
||||
|
||||
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();
|
||||
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();
|
||||
|
||||
// They should be the same when no Google Account email is cached
|
||||
expect(googleAccountEmailResult).toBe('');
|
||||
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+$/);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user