Testing
npm run test:models # pure functions, models, rules
npm run test:integration # route handlers end to end
npm test # both
npm run docs:build # this site, with broken links treated as errors
Two layers, and what separates them
Model tests exercise pure functions: role rules, peer rules, transport parsing, session reducers. They need nothing but Node.
Integration tests run the real route handlers against a real SQLite database created from migrations/, through the shims in tests/shims/: d1-sqlite.mjs gives the routes a D1-shaped binding backed by node:sqlite, r2-memory.mjs an in-memory bucket. They used to require a live Postgres, which meant they were skipped, which meant a column missing from the D1 schema reached production before anyone noticed.
Node version
CI pins Node 24.13.0. node:sqlite is still experimental, and 24.14 ships an undici regression. Both reasons are recorded in .github/workflows/tests.yml; changing the version means checking them again.
What a change should run
- Interface only:
npm run test:modelsand a build. - A route or server logic: the whole suite.
- Documentation:
npm run docs:build. Broken links fail the build, so this catches a renamed page.