Skip to content

fix(test): align setup amount test with fractional-cent rejection - #81

Merged
ralyodio merged 1 commit into
masterfrom
fix/coinpay-fractional-cent-test
Jul 31, 2026
Merged

fix(test): align setup amount test with fractional-cent rejection#81
ralyodio merged 1 commit into
masterfrom
fix/coinpay-fractional-cent-test

Conversation

@ralyodio

Copy link
Copy Markdown
Collaborator

Summary

master has been red since #59, and it is what is blocking #80 (and every other open PR).

#59 made the numeric path of setupAmountUsd reject values finer than a cent, but left this assertion in place:

assert.equal(setupAmountUsd(2.345), 2.35);

That asserts the rounding behavior #59 deliberately removed, so setupAmountUsd accepts ordinary positive dollar amounts has failed on every run since. The failure is unrelated to whatever PR happens to be open — it just shows up on all of them.

This PR fixes the test, not the implementation. The implementation is correct: I swept all 2,000,000 cent-precision values from $0.01$20,000 against the Number.EPSILON guard and found zero false rejections, while 2.345, 1.234 and 0.005 are all correctly rejected.

Changes

  • Assert the numeric path on a value it actually accepts (2.35) instead of one it now rejects.
  • Add the regression coverage #54 asked for — 1.234 and 0.004. fix(money): reject fractional-cent numbers #59's description promised these but only touched lib/coinpay.ts, so they never landed.

Tests

🤖 Generated with Claude Code

PR #59 made the numeric path of setupAmountUsd reject values finer than
a cent, but left the assertion that 2.345 rounds to 2.35 — the exact
behavior it removed. That assertion has failed on master ever since, so
every PR opened since #59 shows a red test check.

Assert the numeric path on a value it actually accepts, and add the
regression coverage issue #54 asked for (1.234 and 0.004) that #59
described but never landed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

vu1nz Security Review

0 finding(s) in PR #?

No security issues found.

@ralyodio
ralyodio marked this pull request as ready for review July 31, 2026 05:23
@ralyodio
ralyodio merged commit 715eaf6 into master Jul 31, 2026
2 checks passed
@ralyodio
ralyodio deleted the fix/coinpay-fractional-cent-test branch July 31, 2026 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant