Commit fb6f7e8
test(template): cover health endpoint dependency status, timeout, and error paths
Replaces the standalone Hono fixture in tests/unit/health.test.ts with
a test that mounts the real healthRoutes inside a Hono parent + requestId
middleware (mirroring index.ts wiring). pingDatabase is mocked via
vi.mock so no real postgres is needed in CI.
Coverage (both Workers and Node test bodies):
- 200 + healthy when DB connected
- version sourced from APP_VERSION (c.env on Workers, process.env on Node)
- numeric uptime >= 0
- 503 + unhealthy when DB disconnected
- 503 on timeout via fake-timer-advanced Promise.race
- 503 on thrown error (never 500)
- requestId preserved in body and X-Request-Id header
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent dd3518e commit fb6f7e8
1 file changed
Lines changed: 190 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments