Skip to content

Add Jest property-based tests for amountValidator covering Stellar/USDC precision boundaries #420

Description

@greatest0fallt1me

Description

src/validators/amountValidator.ts has unit tests but no property-based coverage. Add fast-check properties that fuzz fractional precision, leading zeros, and negative sentinels so we catch silent regressions.

Requirements and Context

  • Use fast-check as a devDependency
  • Property: any input with >7 fractional digits must reject
  • Property: integer-equivalent inputs round-trip
  • Must be secure, tested, and documented
  • Should be efficient and easy to review

Suggested Execution

  1. Fork the repo and create a branch
    git checkout -b task/amount-validator-pbt
  2. Implement changes
    • src/validators/amountValidator.test.ts
    • package.json
  3. Test and commit
    • npm test -- amountValidator
    • Cover edge cases (denormalized numbers, NaN strings)
    • Include test output and notes in the PR

Example commit message

test: property-based coverage for amount validator

Acceptance Criteria

  • At least four fast-check properties pass
  • Runtime under 5s
  • No flaky seeds
  • Docs updated

Guidelines

  • Backend (Node/TS): Jest, minimum 90% coverage
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GRANTFOX OSSGrantFox open-source campaign taskMAYBE REWARDEDMay be rewarded under the GrantFox campaignOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveIssues in the Stellar wave programbackendBackend service worktestingTests and coverage

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions