fix: show a rolled-over usage window as unknown, not 0%
91203d8 rendered an expired window as 0% unconditionally. If the post-reset
refetch fails (network error, 429) the 0% stayed for as long as fetches
kept failing, the same stale-value bug in the other direction. An expired
window now renders as -1 (the empty "─────" unknown cell) until a fetch
succeeds and brings the new window's real value.
Tests: expired window -> -1 for Claude and Codex rows; refetch failing at
+1 min and +60 min stays unknown, then success shows 3%; 429 shows the
429 indicator; renderer draws -1 as the placeholder cell.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -162,6 +162,20 @@ describe('renderUsageTable', () => {
|
||||
expect(lines.some((l) => l.includes('Codex'))).toBe(true);
|
||||
});
|
||||
|
||||
it('renders an unknown (-1) window as the empty placeholder, not a %', () => {
|
||||
const lines = renderUsageTable(
|
||||
[{ ...claudeRow, h5pct: -1 }],
|
||||
[{ ...codexRow, h5pct: -1 }],
|
||||
);
|
||||
const claudeLine = lines.find((l) => l.startsWith('Claude'))!;
|
||||
const codexLine = lines.find((l) => l.startsWith('Codex'))!;
|
||||
for (const line of [claudeLine, codexLine]) {
|
||||
expect(line).toContain('─────');
|
||||
// Only the 7d column carries a percentage.
|
||||
expect(line.match(/%/g)).toHaveLength(1);
|
||||
}
|
||||
});
|
||||
|
||||
it('returns fallback text when both groups are empty', () => {
|
||||
const lines = renderUsageTable([], []);
|
||||
expect(lines).toEqual(['_조회 불가_']);
|
||||
|
||||
Reference in New Issue
Block a user