-
Notifications
You must be signed in to change notification settings - Fork 0
⭐ Testing Strategy
Vitest throughout. 214 backend tests passing, tsc --noEmit clean, 0 lint errors, as of the last full backend phase — the entire backend, models/migrations/helpers/middleware/controllers/routes/seeders/index.ts, is tested. vitest.config.js splits into a backend project (plain environment: "node", no jsdom) and a frontend project (jsdom + setupTests.ts, stayed inert until the first real frontend test file landed), so backend tests never paid for jsdom/setupTests.ts they didn't use. The frontend project now runs 8 tests across 3 files (dateFormatter, errorHandler, requireAuth) — most frontend files still have none, tracked openly as issue #71.
Real in-memory SQLite over hand-stubbed mocks. testUtils/testDb.js runs an actual in-memory SQLite Sequelize instance against the real models, used for every controller test — controllers like articles.js touch too many Sequelize methods for per-method mocking to stay maintainable, and a real (if in-memory) DB catches things a mock can't.
Every fix in this repo is proven meaningful the same way: deliberately revert it, watch the specific test fail against the original bug, then restore. Not just written and assumed — actually re-run in the broken state first. This is the standard applied across Models and Migrations, Helpers, Middleware, and Controllers alike.
Route-layer tests use supertest for real HTTP calls through the actual middleware chain rather than re-testing controller logic — see Routes for the .ts-interop lessons that testing this layer surfaced.