Skip to content
Open
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
11 changes: 8 additions & 3 deletions app/components/BillingCreditsViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,14 @@
<div v-if="topTokensChartData" style="height: 280px">
<Bar :data="topTokensChartData" :options="topTokensChartOptions" />
</div>
<v-alert v-else type="info" variant="tonal" density="compact">
No per-user CLI token usage available — load the User Metrics tab
once so token data is fetched, then revisit.
<v-alert
v-else
type="info"
variant="tonal"
density="compact"
data-testid="billing-top-token-users-empty-state"
>
No CLI token usage was reported for any user in this period.
</v-alert>
</v-card-text>
</v-card>
Expand Down
16 changes: 16 additions & 0 deletions tests/billing-credits-top-token-empty-state.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// @vitest-environment node
import { describe, expect, test } from 'vitest';
import { readFileSync } from 'node:fs';

const componentSource = readFileSync(
new URL('../app/components/BillingCreditsViewer.vue', import.meta.url),
'utf8'
);

describe('BillingCreditsViewer Top token users empty state', () => {
test('uses accurate guidance when no CLI token usage is reported', () => {
expect(componentSource).toContain('data-testid="billing-top-token-users-empty-state"');
expect(componentSource).toContain('No CLI token usage was reported for any user in this period.');
expect(componentSource).not.toContain('load the User Metrics tab');
});
});
Loading