ops(api): lägg till /ops/v1/health för EOC

This commit is contained in:
Sven (AAMOS AI)
2026-08-11 07:37:51 +07:00
parent 714d0a2e5b
commit 63d83e0d7c
2 changed files with 35 additions and 0 deletions
+30
View File
@@ -24,6 +24,36 @@ const planPrices = {
large_household: 19900,
};
describe("/ops/v1/health", () => {
let app: Awaited<ReturnType<typeof buildServer>>;
beforeAll(async () => {
app = await buildServer(config);
await app.ready();
});
afterAll(async () => {
await app.close();
});
it("avvisar anrop utan token", async () => {
const res = await app.inject({ method: "GET", url: "/ops/v1/health" });
expect(res.statusCode).toBe(401);
});
it("returnerar ok med app-namn vid giltig token", async () => {
const res = await app.inject({
method: "GET",
url: "/ops/v1/health",
headers: { authorization: `Bearer ${config.OPS_TOKEN}` },
});
expect(res.statusCode).toBe(200);
const body = JSON.parse(res.body) as { ok: boolean; app: string };
expect(body.ok).toBe(true);
expect(body.app).toBe("cibello");
});
});
describe("/ops/v1/summary", () => {
let app: Awaited<ReturnType<typeof buildServer>>;