Files
Maurice 4780a7be90 Typecheck the test tree, and fix what it found
server/tsconfig.json has include: ["src"], so tests/ was never typechecked.
A service that gained a constructor parameter did not break its hand-wired
call sites at compile time — the argument arrived as undefined and threw at
runtime, if anything read it at all. The notifications sweep hit 46 such
sites and only a stash-diff against a throwaway tsconfig found them.

tsconfig.tests.json makes that permanent. It is not wired into CI yet: the
tree still reports 170 errors, and turning it on now would block every
unrelated PR.

Three of the first fixes were not type noise.

DAY-SVC-034 asserted that createAccommodation rolls back a failed
reservation insert. That method moved to AccommodationsService in the
days/accommodations split, so the case was calling undefined — which throws,
which satisfied .toThrow(). The rollback has been unchecked ever since,
while the case reported green. Repointed at the owner; the invariant holds.

host-rpc.test.ts typed its response as RpcResponse & Partial<RpcError>.
Both carry ok, one as true and one as false, so the intersection is never
and all 97 property reads in the file were errors nobody could see.

auth.controller.test.ts passes {} as the body in cases that stub the service
and assert on the mapping around it. That is correct as written — the point
of several of them is that the error path never reads the body — so anyBody()
names the intent instead of inventing fields the assertions do not read.
Three changePassword calls were genuinely missing the @Res() argument.
2026-08-10 19:54:46 +02:00

17 lines
713 B
TypeScript

/**
* A request body the case under test does not read.
*
* Controller unit tests stub the service and assert on the mapping around it:
* which status an error becomes, whether the cookie is set, which audit fires.
* The body never reaches validation on that path, because the global
* ZodValidationPipe is not in the unit harness, so filling in plausible fields
* would be inventing data no assertion looks at.
*
* Written as a named helper rather than a bare `as` cast so the intent is
* greppable: `anyBody()` means "irrelevant here", not "we gave up on the type".
* Anything a case DOES read belongs in the argument.
*/
export function anyBody<T>(body: Partial<T> = {}): T {
return body as T;
}