This page is for contributors testing code inside the solvapay-sdk monorepo.
- Unit tests: package-level behavior with isolated mocks/stubs
- Integration tests: end-to-end flows across adapters and HTTP handlers
- Example validation: verify runnable examples stay in sync with package APIs
Use stub mode for deterministic local and CI testing without real API credentials.
import { createSolvaPay } from '@solvapay/server'
// No API key => stub mode
const solvaPay = createSolvaPay()You can also inject a custom stub client when you need tighter control over limits, storage, or artificial delay behavior.
- Create a fresh client in
beforeEachto keep tests isolated - Keep free-tier limits small in tests (for example
1-5) to exercise paywall paths quickly - Assert structured paywall error fields (not only message text)
- Use in-memory storage by default for speed and reliability
- purchase checks and limit checks
- customer resolution and creation paths
- paywall errors and checkout URL generation
- usage event tracking behavior
- framework adapters (
http,next, andmcp)
pnpm test
pnpm -F @solvapay/server test
pnpm -F @solvapay/react testBefore opening a PR, make sure:
- all relevant package tests pass
- docs links are valid (
pnpm docs:validate-links) - any new behavior has coverage in unit or integration tests
CONTRIBUTING.mdfor contributor workflowexamples/for runnable integration referencespackages/*/README.mdfor package-specific usage constraints