Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
281 changes: 57 additions & 224 deletions src/components/quota/quotaConfigs.ts

Large diffs are not rendered by default.

45 changes: 42 additions & 3 deletions src/features/monitoring/accountOverviewQuotaTargets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import type { MonitoringAccountRow } from './hooks/useMonitoringData';
import type { MonitoringAccountAuthState } from './accountOverviewState';
import { buildMonitoringAccountQuotaTargetsByAccount } from './accountOverviewQuotaTargets';

const createAccountRow = (
overrides: Partial<MonitoringAccountRow> = {}
): MonitoringAccountRow => ({
const createAccountRow = (overrides: Partial<MonitoringAccountRow> = {}): MonitoringAccountRow => ({
id: overrides.id ?? 'account@example.com',
account: overrides.account ?? 'account@example.com',
displayAccount: overrides.displayAccount ?? overrides.account ?? 'account@example.com',
Expand Down Expand Up @@ -80,4 +78,45 @@ describe('accountOverviewQuotaTargets', () => {
{ authIndex: '2', fileName: 'beta.json', authLabel: 'Beta' },
]);
});

it('keeps Codex quota targets when the account id is unavailable', () => {
const authStateByRowId = new Map<string, MonitoringAccountAuthState>([
[
'account@example.com',
{
files: [
{
name: 'codex-without-account.json',
type: 'codex',
authIndex: '1',
label: 'Codex',
account: 'account@example.com',
},
],
toggleableFileNames: ['codex-without-account.json'],
enabledState: 'enabled',
},
],
]);

const result = buildMonitoringAccountQuotaTargetsByAccount(
[
createAccountRow({
id: 'account@example.com',
account: 'account@example.com',
authIndices: ['1'],
authLabels: ['Codex'],
}),
],
authStateByRowId
);

expect(result.get('account@example.com')).toMatchObject([
{
authIndex: '1',
fileName: 'codex-without-account.json',
accountId: null,
},
]);
});
});
Loading
Loading