fix(cliproxy): refresh non-default gemini quota tokens

This commit is contained in:
Tam Nhu Tran committed 2026-04-08 23:55:55 -04:00
1 parent 04878f0864
commit b6fb443f57
11 files changed
+207 -71

No files matched your search

@@ -133,6 +133,9 @@ describe('AccountCard grouped quota tooltip', () => {
await userEvent.hover(screen.getByText('Business'));
expect((await screen.findAllByText('Plan: team')).length).toBeGreaterThan(0);
expect(screen.getAllByText('5h usage limit').length).toBeGreaterThan(0);
const tooltipContent = document.querySelector('[data-slot="tooltip-content"]');
expect(tooltipContent?.className).toContain('bg-popover');
expect(tooltipContent?.className).toContain('text-popover-foreground');
await userEvent.hover(screen.getByText('Personal'));
expect((await screen.findAllByText('Plan: plus')).length).toBeGreaterThan(0);
@@ -90,4 +90,28 @@ describe('QuotaTooltipContent', () => {
vi.useRealTimers();
});
it('renders failure summaries, action hints, and raw details with readable structure', () => {
const quota = createGeminiQuotaResult({
success: false,
buckets: [],
error: 'Request had invalid authentication credentials.',
httpStatus: 401,
errorCode: 'UNAUTHENTICATED',
errorDetail:
'{"error":{"code":401,"message":"Request had invalid authentication credentials.","status":"UNAUTHENTICATED"}}',
actionHint: 'Run ccs gemini --auth to reconnect this account.',
needsReauth: true,
});
render(<QuotaTooltipContent quota={quota} resetTime={null} />);
expect(screen.getByText('Reauth')).toBeInTheDocument();
expect(screen.getByText('Request had invalid authentication credentials.')).toBeInTheDocument();
expect(
screen.getByText('Run ccs gemini --auth to reconnect this account.')
).toBeInTheDocument();
expect(screen.getByText('HTTP 401 | UNAUTHENTICATED')).toBeInTheDocument();
expect(screen.getByText(/"status":"UNAUTHENTICATED"/)).toBeInTheDocument();
});
});