Operations

Testing & CI

The API has an extensive integration suite against real Postgres. The dashboard unit-tests its pure logic, and the POS has no tests yet. CI runs only in api-v2.


api-v2

  • vitest 2 + supertest against a real Postgres (totlob_test).
  • fileParallelism: false, single fork, 20 s timeout (vitest.config.ts).
  • About 2,270 test cases across 72 integration and 29 unit files.
  • The full run takes several minutes; the last measured run was 1,868 tests in 231 s.

Enforcement tests

TestFails when
test/unit/route-permissions.test.tsA route has no authorisation decision
test/unit/module-boundaries.test.tsA module touches a table it doesn't own, or an import cycle appears

Running tests locally

Run the targeted pair, then push and let CI run everything:

npx vitest run <feature> && npx vitest run test/unit

If the test database drifts from the migrations, run npm run db:test-reset.

CI

.github/workflows/ci.yml runs on every PR and on pushes to master:

  1. Services: postgres:16 on 5433, redis:7 on 6380
  2. npm ci
  3. npm run db:migrate
  4. Typecheck
  5. npm test
  6. Build

There's no deploy workflow in the repo. Deploys are configured on Heroku. See Deployment.

Merchant dashboard

  • Vitest 3.2, npm test.
  • 12 unit files, all for pure logic: nav, categoryTransfer, categoryTransferFiles, productTransfer, order, orderLocations, phone, dateInput, jarde, product, timezones, assistantClient.
  • No component or end-to-end tests.
  • The build (tsc -b) fails on a missing Arabic translation.

Point of sale

  • No test framework. .scratch/pos-shifts/spec.md says so explicitly.
  • The safety net is tsc -b (strict) and oxlint.
  • The money and pricing logic in lib/money.ts and state/cart.ts mirrors the server and is the obvious first candidate for unit tests.
Previous
Local development