TheVicky1 / TheVicky1/Pact_OS

test: add unit tests for formatCentsToDollars edge cases (negative & zero values)

Open Beginner friendly
#18 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:testing beginner friendly community contributions-welcome difficulty:beginner difficulty:easy enhancement good first issue help wanted time:<15m type:test up-for-grabs
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.ts
  • src/lib/money.ts

✅ Acceptance criteria

  • Unit tests added covering negative numbers, zero, and boundary values.
  • node scratch/run-tests.mjs executes cleanly with all tests passing.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.