Skip to content

Implement property-based testing suite for the SDK using fast-check #418

Description

@Kingsman-99

Overview

Add property-based tests using fast-check that verify SDK invariants hold for arbitrary inputs. This goes beyond unit tests by generating hundreds of random inputs per property and shrinking failures to minimal reproducible cases.

Requirements

  • Install fast-check as a dev dependency
  • Write property tests for:
    • parseAmount / formatAmount roundtrip: formatAmount(parseAmount(x)) === x for all valid USDC strings
    • isValidAddress: any 56-char G-prefixed base32 string passes; anything else fails
    • deadlineFromDays(n) > Date.now() / 1000 for all n > 0
    • createInvoice parameters: arbitrary recipient counts (1–20), amounts summing to any positive value
    • StellarSplitClient methods: sequential call sequences never leave the client in an inconsistent state (using a mock contract)
  • Each property must run at least 500 examples
  • All properties must have meaningful fc.assert failure messages for debugging

Acceptance Criteria

  • fast-check installed and configured
  • At least 5 property test files covering the above
  • Each property runs 500+ examples
  • All properties pass
  • npm test passes with zero failures
  • TypeScript compiles with zero errors
  • ESLint passes with zero errors

Definition of Done

All CI checks must pass before the PR is reviewed.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions