import { describe, expect, it } from "vitest"; import { buildApp } from "../src/app.js"; import { loadConfig } from "../src/config.js"; describe("health", () => { it("GET /health returns ok", async () => { const app = await buildApp({ config: { ...loadConfig(), staticDir: null }, memory: true, }); const res = await app.inject({ method: "GET", url: "/health" }); expect(res.statusCode).toBe(200); expect(res.json()).toEqual({ status: "ok" }); await app.close(); }); it("GET /ready returns database status", async () => { const app = await buildApp({ config: { ...loadConfig(), staticDir: null }, memory: true, }); const res = await app.inject({ method: "GET", url: "/ready" }); expect(res.statusCode).toBe(200); const body = res.json(); expect(body.database).toBe(true); expect(["ready", "degraded"]).toContain(body.status); await app.close(); }); });