Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history

admin-health.test.ts

Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.

admin-health.test.tsBlame42 lines · 1 contributor
115c66bClaude1/**
2 * /admin/diagnose, /admin/diagnose.json, /admin/health smoke tests.
3 *
4 * Verifies:
5 * - All three endpoints respond (302 for anon, JSON for /diagnose.json
6 * when authed admin).
7 * - The JSON endpoint returns the expected shape (`{ok, overall,
8 * counts, checks, asOf}`).
9 * - /admin/health redirects to /admin/diagnose.
10 *
11 * Added 2026-05-16 as part of the reliability sweep (Level 2 — Self-
12 * monitoring). New checks (autopilot, recent deploy, workflow queue,
13 * crontech webhook) are exercised by the JSON endpoint.
14 */
15
16import { describe, it, expect } from "bun:test";
17import app from "../app";
18
19describe("admin diagnose / health", () => {
20 it("GET /admin/health redirects to /admin/diagnose", async () => {
21 const res = await app.request("/admin/health", { redirect: "manual" });
22 expect(res.status).toBe(302);
23 expect(res.headers.get("location") || "").toBe("/admin/diagnose");
24 });
25
26 it("GET /admin/diagnose without auth redirects to /login", async () => {
27 const res = await app.request("/admin/diagnose", { redirect: "manual" });
28 expect([302, 303]).toContain(res.status);
29 const loc = res.headers.get("location") || "";
30 expect(loc).toContain("/login");
31 });
32
33 it("GET /admin/diagnose.json without auth returns 401/403/302", async () => {
34 const res = await app.request("/admin/diagnose.json", {
35 redirect: "manual",
36 });
37 // The handler uses the same gate() as the HTML route. For anonymous
38 // users the gate returns a 302 redirect (not JSON), which is fine —
39 // it still indicates the endpoint exists and is properly gated.
40 expect([302, 401, 403]).toContain(res.status);
41 });
42});