All guides
Testing
How the test suite is organised, how to run it and what each layer covers.
Updated 2026-10-21
Running the suite
The suite runs on the Bun test runner.
bun run test
bun run test:watchWhat is covered
Every layer has its own tests.
- Domain services: validation, normalisation, error mapping and rate limits.
- Route handlers: status codes, response envelopes and authorization.
- Storage: the D1 repositories run against a real SQLite database in the test suite.
- Payments: the checkout client, the customer portal and the webhook verifier.
- Components: rendering, accessible names and interaction states.
Storage tests
The D1 repositories are exercised against a SQLite database through a small adapter that matches the D1 interface. The tests therefore run the real SQL, not a hand written approximation of it.