-
Notifications
You must be signed in to change notification settings - Fork 10.2k
test: clarify toPercent boundary at 1.0 #4436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The description says "Split the existing boundary test into two cases and add Prompt To Fix With AIThis 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 }, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title is "clarify toPercent boundary at 1.0" and the description states that
1.0should become1%(not100%), but the new test only exercises42— well above the boundary. The exact boundary value1.0(the first integer value that triggers the "already-percentage" path instead of the fraction-multiplication path) is never asserted. Without a test at exactly1.0, the stated guarantee isn't verified and a future refactor could regress it silently.Prompt To Fix With AI