test: add unit tests for formatCentsToDollars edge cases (negative & zero values)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5
- Forks
- 7
- Avg merge
- 39m
- Merged PRs (30d)
- 39
Description
🎯 What needs to be done
Add unit tests in tests/finance-domain-validation.test.ts testing negative values (-1050 -> -$10.50), zero cents (0 -> $0.00), and large numbers in src/lib/money.ts.
Why this matters
Financial integrity is a top priority in PACT. Exhaustive unit testing on integer-cents conversion prevents rounding and formatting regressions.
📍 Where to work
tests/finance-domain-validation.test.tssrc/lib/money.ts
✅ Acceptance criteria
- Unit tests added covering negative numbers, zero, and boundary values.
-
node scratch/run-tests.mjsexecutes cleanly with all tests passing.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/lib/money.ts to inspect formatCentsToDollars, then review the existing cases in tests/finance-domain-validation.test.ts. Add coverage for negative cents, zero, and large or boundary values, including the examples in the issue. Run node scratch/run-tests.mjs and confirm all tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100