Testing
Last reviewed: 2026-06-30
The suite is layered so behavior is tested at the cheapest tier that can catch real failures.
Commands
Section titled “Commands”npm run docs:checknpm run docs:buildnpm run worker:assetsnpm run typechecknpm testDashboard or Worker build changes may also require:
npm run dashboard:buildnpm run dashboard:quality| Tier | Files | Purpose |
|---|---|---|
| Unit | worker/test/*.unit.test.ts |
Pure logic, mappers and validators. |
| Integration | worker/test/*.integration.test.ts |
Worker routes plus storage/modules in process. |
| Contract | worker/test/*.contract.test.ts |
OpenAPI, schemas, bridge and split-surface contracts. |
| E2E | worker/e2e/*.e2e.test.ts |
Wrangler/workerd artifact smoke tests. |
- Do not fake validation, logs, screenshots, API responses or reviewer results.
- Assert observable outcomes rather than mock call counts when state or response data is available.
- Keep tenant/app isolation negative tests close to code that touches scoped data.
- Never weaken existing assertions to make a change pass.