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
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-utilspackage eliminates duplication and makes tests easier to write.Requirements and context
packages/test-utils/src/with:mockKeypair()— generate deterministic test Stellar keypairsmockInvoice(overrides?)— create fakeInvoiceobjectsmockHorizonClient()— mock Horizon streaming and REST responsesmockContractResponse(method, result)— mock Soroban simulation responsesmockReputationScore(overrides?)— create fake reputation datapackages/test-utils/index.ts@invoice-liquidity/test-utilsin testsSuggested execution
packages/test-utils/packageExample commit message
feat: add shared test-utils package with mock factories for all packages