import { expect, it } from 'bun:test';
import { renderToStaticMarkup } from 'react-dom/server';
import { AuthFileQuotaPanel } from '../src/components/AuthFileQuotaPanel';
import { I18nProvider } from '../src/i18n';
import type { AuthFile, QuotaState } from '../src/services/quotaService';
const renderDense = (quota: QuotaState, file: AuthFile = { name: 'test.json', provider: 'codex' }, busy = false) =>
renderToStaticMarkup( {}} onReset={() => {}} />);
it('keeps window percentages, reset times and additional windows available in dense mode', () => {
const html = renderDense({ status: 'success', rows: [
{ label: '5h', remainingPercent: 140, reset: '10:30', detail: 'Window detail' },
{ label: 'weekly', remainingPercent: null, reset: 'Friday' },
{ label: 'extra', remainingPercent: 0, reset: 'Monday' },
] });
expect(html).toContain('credential-quota-dense');
expect(html).toContain('aria-valuenow="100"');
expect(html).not.toContain('140%');
expect(html).toContain('credential-quota-row unknown');
expect(html).toContain('title="10:30">10:30');
expect(html).toContain('Window detail');
expect(html).toContain('');
expect(html).toContain('extra');
});
it('shows reset credits beside the button while preserving applicability and expiry', () => {
const html = renderDense({ status: 'success', rows: [{ label: '5h', remainingPercent: 0 }],
resetCredits: 2, resetCreditsApplicable: 0, subscriptionActiveUntil: '2030-01-01T00:00:00Z',
});
const resetButton = html.match(/