Build, Test, and Push CFDM Docker Image / test (push) Has been cancelled
Build, Test, and Push CFDM Docker Image / build-and-push (push) Has been cancelled
Build, Test, and Push CFDM Docker Image / create-release (push) Has been cancelled
Build, Test, and Push CFDM Docker Image / update-wiki (push) Has been cancelled
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();
|
|
});
|
|
});
|