Skip to content
Open
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
6 changes: 6 additions & 0 deletions server/src/__tests__/quota-windows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,12 @@ describe("fetchClaudeQuota", () => {
expect(windows[0]!.usedPercent).toBe(null);
});

it("handles utilization as already-percentage (>= 1) instead of fraction", async () => {
mockFetch({ five_hour: { utilization: 42, resets_at: null } });
const windows = await fetchClaudeQuota("token");
expect(windows[0]!.usedPercent).toBe(42);
});
Comment on lines +579 to +583
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Boundary case at 1.0 missing despite PR title

The PR title is "clarify toPercent boundary at 1.0" and the description states that 1.0 should become 1% (not 100%), but the new test only exercises 42 — well above the boundary. The exact boundary value 1.0 (the first integer value that triggers the "already-percentage" path instead of the fraction-multiplication path) is never asserted. Without a test at exactly 1.0, the stated guarantee isn't verified and a future refactor could regress it silently.

Prompt To Fix With AI
This is a comment left during a code review.
Path: server/src/__tests__/quota-windows.test.ts
Line: 579-583

Comment:
**Boundary case at 1.0 missing despite PR title**

The PR title is "clarify toPercent boundary at 1.0" and the description states that `1.0` should become `1%` (not `100%`), but the new test only exercises `42` — well above the boundary. The exact boundary value `1.0` (the first integer value that triggers the "already-percentage" path instead of the fraction-multiplication path) is never asserted. Without a test at exactly `1.0`, the stated guarantee isn't verified and a future refactor could regress it silently.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +579 to +583
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 PR description describes changes not present in the diff

The description says "Split the existing boundary test into two cases and add 101 to the clamp-overshoot test," but the diff only adds a single new test and neither a split of the existing boundary test nor a 101 clamp-overshoot test appears anywhere. Please either update the description to match the actual change, or include the missing test cases.

Prompt To Fix With AI
This is a comment left during a code review.
Path: server/src/__tests__/quota-windows.test.ts
Line: 579-583

Comment:
**PR description describes changes not present in the diff**

The description says "Split the existing boundary test into two cases and add `101` to the clamp-overshoot test," but the diff only adds a single new test and neither a split of the existing boundary test nor a `101` clamp-overshoot test appears anywhere. Please either update the description to match the actual change, or include the missing test cases.

How can I resolve this? If you propose a fix, please make it concise.


it("includes all four windows when all are present", async () => {
mockFetch({
five_hour: { utilization: 10.0, resets_at: null },
Expand Down
Loading