Common module has no tests: request-id middleware and shared helpers are uncovered
Labels / Complexity: testing · Medium Complexity — Medium
Problem
src/common/ (8 files, 0 *.spec.ts anywhere) holds the cross-cutting middleware and shared utilities every request passes through — including request-id.middleware.ts, which stamps X-Request-Id used for tracing and log correlation. None of it is pinned by tests: a regression that drops or duplicates request ids breaks log correlation silently across the whole app.
Why this is architecturally hard
- Middleware needs request-level tests. Testing middleware means constructing mock
Request/Response/next objects or e2e assertions on response headers; the contributor picks the existing convention.
- Shared helpers are used everywhere. Any behavior change to helpers in
src/common/ has repo-wide blast radius, which is exactly why their current behavior must be pinned first.
Acceptance criteria
- Tests cover request-id assignment (present, absent, and already-set headers).
- Shared helper functions in
src/common/ have unit coverage.
- Tests run in CI via
npm test.
Out of scope
Changing middleware behavior.
Getting started
src/common/request-id.middleware.ts — the middleware to cover
src/common/ — the helpers
Commands: npm test, npm run test:cov.
Good first files to read: src/common/request-id.middleware.ts, test/unit/search-facets.service.spec.ts.
Common module has no tests: request-id middleware and shared helpers are uncovered
Labels / Complexity: testing · Medium Complexity — Medium
Problem
src/common/(8 files, 0*.spec.tsanywhere) holds the cross-cutting middleware and shared utilities every request passes through — includingrequest-id.middleware.ts, which stampsX-Request-Idused for tracing and log correlation. None of it is pinned by tests: a regression that drops or duplicates request ids breaks log correlation silently across the whole app.Why this is architecturally hard
Request/Response/nextobjects or e2e assertions on response headers; the contributor picks the existing convention.src/common/has repo-wide blast radius, which is exactly why their current behavior must be pinned first.Acceptance criteria
src/common/have unit coverage.npm test.Out of scope
Changing middleware behavior.
Getting started
src/common/request-id.middleware.ts— the middleware to coversrc/common/— the helpersCommands:
npm test,npm run test:cov.Good first files to read:
src/common/request-id.middleware.ts,test/unit/search-facets.service.spec.ts.