mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-14 14:17:11 +00:00
fix(cliproxy): prefer live entitlement tier in account badges
This commit is contained in:
1 parent
f9c61e0fac
commit
7330fdbf28
2 files changed
+70
-7
No files matched your search
@@ -0,0 +1,49 @@
|
||||
import { render, screen } from '@tests/setup/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { AccountSurfaceCard } from '@/components/account/shared/account-surface-card';
|
||||
import type { GeminiCliQuotaResult } from '@/lib/api-client';
|
||||
|
||||
function createGeminiQuotaResult(
|
||||
overrides: Partial<GeminiCliQuotaResult> = {}
|
||||
): GeminiCliQuotaResult {
|
||||
return {
|
||||
success: true,
|
||||
buckets: [],
|
||||
projectId: 'project-123',
|
||||
tierLabel: 'Pro',
|
||||
tierId: 'g1-pro-tier',
|
||||
creditBalance: 12,
|
||||
entitlement: {
|
||||
normalizedTier: 'pro',
|
||||
rawTierId: 'g1-pro-tier',
|
||||
rawTierLabel: 'Pro',
|
||||
source: 'runtime_api',
|
||||
confidence: 'high',
|
||||
accessState: 'entitled',
|
||||
capacityState: 'available',
|
||||
lastVerifiedAt: Date.now(),
|
||||
notes: null,
|
||||
},
|
||||
lastUpdated: Date.now(),
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
describe('AccountSurfaceCard', () => {
|
||||
it('prefers live quota entitlement tier over a stale account tier for Gemini badges', () => {
|
||||
render(
|
||||
<AccountSurfaceCard
|
||||
mode="compact"
|
||||
provider="gemini"
|
||||
accountId="user@example.com"
|
||||
email="user@example.com"
|
||||
displayEmail="user@example.com"
|
||||
tier="unknown"
|
||||
quota={createGeminiQuotaResult()}
|
||||
showQuota={false}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByText('pro')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user