mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-18 08:14:17 +00:00
fix(accounts): refine codex plan badges
This commit is contained in:
1 parent
72ea1fc9d6
commit
25aa8bdb16
10 files changed
+111
-33
No files matched your search
@@ -20,7 +20,11 @@ vi.mock('@/hooks/use-cliproxy-stats', async () => {
|
||||
const mockedUseAccountQuota = vi.mocked(useAccountQuota);
|
||||
const mockedUseAccountQuotas = vi.mocked(useAccountQuotas);
|
||||
|
||||
function makeCodexQuota(planType: 'free' | 'plus' | 'team', fiveHour: number, weekly: number) {
|
||||
function makeCodexQuota(
|
||||
planType: 'free' | 'plus' | 'pro' | 'team',
|
||||
fiveHour: number,
|
||||
weekly: number
|
||||
) {
|
||||
return {
|
||||
success: true,
|
||||
planType,
|
||||
@@ -201,5 +205,6 @@ describe('AccountCard grouped quota tooltip', () => {
|
||||
expect(screen.getByTitle('Business · Workspace 04a0f049 • Personal · Pro')).toBeInTheDocument();
|
||||
expect(screen.getByText('Personal · Pro')).toBeInTheDocument();
|
||||
expect(screen.queryByText('Free')).not.toBeInTheDocument();
|
||||
expect(screen.getByText('Pro')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -75,7 +75,7 @@ describe('AccountSurfaceCard', () => {
|
||||
expect(screen.queryByText('Pers')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('keeps the simplified personal audience when live quota planType is coarser', () => {
|
||||
it('keeps token-derived personal detail when live quota planType is coarser', () => {
|
||||
render(
|
||||
<AccountSurfaceCard
|
||||
mode="compact"
|
||||
@@ -90,6 +90,7 @@ describe('AccountSurfaceCard', () => {
|
||||
);
|
||||
|
||||
expect(screen.getByText('Pers')).toBeInTheDocument();
|
||||
expect(screen.getByText('Pro')).toBeInTheDocument();
|
||||
expect(screen.queryByText('Free')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -109,4 +110,21 @@ describe('AccountSurfaceCard', () => {
|
||||
expect(screen.getByText('Free')).toBeInTheDocument();
|
||||
expect(screen.queryByText('Pers')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('falls back to plus or pro detail when Codex quota exposes a paid plan', () => {
|
||||
render(
|
||||
<AccountSurfaceCard
|
||||
mode="compact"
|
||||
provider="codex"
|
||||
accountId="user@example.com"
|
||||
email="user@example.com"
|
||||
displayEmail="user@example.com"
|
||||
quota={createCodexQuotaResult({ planType: 'pro' })}
|
||||
showQuota={false}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByText('Pers')).toBeInTheDocument();
|
||||
expect(screen.getByText('Pro')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -58,14 +58,21 @@ describe('account identity presentation', () => {
|
||||
).toBe('kaidu.kd@gmail.com (Free)');
|
||||
});
|
||||
|
||||
it('collapses paid codex personal plans into a single personal audience label', () => {
|
||||
it('keeps plus and pro codex personal plans distinct', () => {
|
||||
expect(
|
||||
formatAccountDisplayName(
|
||||
'kaidu.kd@gmail.com',
|
||||
'kaidu.kd@gmail.com',
|
||||
'codex-kaidu.kd@gmail.com-plus.json'
|
||||
)
|
||||
).toBe('kaidu.kd@gmail.com (Personal)');
|
||||
).toBe('kaidu.kd@gmail.com (Personal · Plus)');
|
||||
expect(
|
||||
formatAccountDisplayName(
|
||||
'kaidu.kd@gmail.com',
|
||||
'kaidu.kd@gmail.com',
|
||||
'codex-kaidu.kd@gmail.com-pro.json'
|
||||
)
|
||||
).toBe('kaidu.kd@gmail.com (Personal · Pro)');
|
||||
});
|
||||
|
||||
it('leaves plain accounts without inferred state untouched', () => {
|
||||
|
||||
Reference in new issue
Block a user