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
| Test | Fails when |
|---|---|
test/unit/route-permissions.test.ts | A route has no authorisation decision |
test/unit/module-boundaries.test.ts | A 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:
- Services:
postgres:16on 5433,redis:7on 6380 npm cinpm run db:migrate- Typecheck
npm test- 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.mdsays so explicitly. - The safety net is
tsc -b(strict) and oxlint. - The money and pricing logic in
lib/money.tsandstate/cart.tsmirrors the server and is the obvious first candidate for unit tests.