Skip to content

Add packages/test-utils/ shared testing utilities #367

Description

@Levi-Ojukwu

Description
The SDK, CLI, indexer, and notifications tests all need similar utilities: mock Stellar keypairs, mock contract responses, mock Horizon clients, and fake invoice data factories. Centralising these in a shared test-utils package eliminates duplication and makes tests easier to write.

Requirements and context

  • Create packages/test-utils/src/ with:
    • mockKeypair() — generate deterministic test Stellar keypairs
    • mockInvoice(overrides?) — create fake Invoice objects
    • mockHorizonClient() — mock Horizon streaming and REST responses
    • mockContractResponse(method, result) — mock Soroban simulation responses
    • mockReputationScore(overrides?) — create fake reputation data
  • Export everything from packages/test-utils/index.ts
  • Each package in the monorepo should import from @invoice-liquidity/test-utils in tests

Suggested execution

git checkout -b feat/shared-test-utils
  • Create packages/test-utils/ package
  • Migrate duplicate mock utilities from each package's tests
  • Update all affected test files to use the shared package

Example commit message
feat: add shared test-utils package with mock factories for all packages

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions