quality / commitlint (push) Skipped
CD / update-wiki (push) Failing after 7s
quality / changes (push) Successful in 4s
quality / docker-check (push) Skipped
quality / web (push) Failing after 38s
quality / api (push) Successful in 49s
CD / quality (push) Failing after 1m36s
CD / publish (push) Skipped
34 lines
947 B
TypeScript
34 lines
947 B
TypeScript
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();
|
|
});
|
|
});
|