-
Notifications
You must be signed in to change notification settings - Fork 0
⭐ Routes
Terrence Daniels edited this page Aug 14, 2026
·
1 revision
7 route files — pure wiring, so the meaningful test for each is a real HTTP request through the actual middleware chain (verifyToken → controller → errorHandler) via supertest, not introspecting Express's internal router or re-testing controller logic already covered elsewhere.
This layer is also where this repo worked out its .ts-requiring-.ts interop rules the hard way, one real runtime failure at a time:
-
import x = require("./y")typechecks fine but still compiles to a plainrequire()call underneath — and plain Noderequire()cannot resolve a.tsextension no matter how it's spelled in TypeScript. A real ESimport x from "./y"is what actually works, since Vite/esbuild's resolver (used for genuineimportstatements) understands extensionless.tsresolution natively. - A module built with
export = {...}can only ever be referenced via a default import, never a named one —import { getProfile } from "..."is an outright type error, regardless of what the object looks like at runtime. -
require.resolve(...)inside a test's cache-eviction helper only makes sense for genuinely-.jssiblings. A.tssibling doesn't belong in that manual eviction list at all —vi.resetModules()already handles it as part of Vitest's own module graph.
A route-ordering regression test also lives here: GET /feed must not be shadowed by GET /:slug — confirmed it isn't, since /feed is registered first.