CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | /**
* Smoke tests for the public /status page, /status.svg badge, and SEO
* routes (/robots.txt + /sitemap.xml). These don't stub the DB — they
* tolerate either success (dev DB reachable) or a graceful error page
* so they work in the sandbox environment.
*/
import { test, expect } from "bun:test";
import app from "../app";
test("/status returns 200 with HTML body", async () => {
const res = await app.request("/status");
expect(res.status).toBe(200);
const body = await res.text();
expect(body).toContain("<html");
// Either the green or red headline should appear
expect(
body.includes("All systems operational") ||
body.includes("Degraded performance") ||
body.includes("Major outage")
).toBe(true);
});
test("/status.svg returns an SVG badge", async () => {
const res = await app.request("/status.svg");
expect(res.status).toBe(200);
expect(res.headers.get("content-type")).toMatch(/image\/svg/);
const body = await res.text();
expect(body).toContain("<svg");
expect(body).toContain("</svg>");
});
test("/robots.txt returns 200 with crawler directives", async () => {
const res = await app.request("/robots.txt");
expect(res.status).toBe(200);
expect(res.headers.get("content-type")).toMatch(/text\/plain/);
const body = await res.text();
expect(body).toContain("User-agent:");
expect(body).toContain("Sitemap:");
expect(body).toContain("Disallow: /admin");
});
test("/sitemap.xml returns valid-looking XML", async () => {
const res = await app.request("/sitemap.xml");
expect(res.status).toBe(200);
expect(res.headers.get("content-type")).toMatch(/xml/);
const body = await res.text();
expect(body).toContain('<?xml');
expect(body).toContain("<urlset");
expect(body).toContain("<loc>");
expect(body).toContain("</urlset>");
});
test("sitemap includes the landing, status, explore URLs", async () => {
const res = await app.request("/sitemap.xml");
const body = await res.text();
expect(body).toMatch(/<loc>[^<]*\/<\/loc>/);
expect(body).toContain("/status");
expect(body).toContain("/explore");
});
test("/llms.txt maps the platform for AI agents", async () => {
const res = await app.request("/llms.txt");
expect(res.status).toBe(200);
expect(res.headers.get("content-type")).toMatch(/text\/plain/);
const body = await res.text();
// llmstxt.org shape: H1 title + blockquote summary.
expect(body.startsWith("# Gluecron")).toBe(true);
expect(body).toContain("\n> ");
// Must point agents at the load-bearing surfaces.
expect(body).toContain("/mcp");
expect(body).toContain("/.well-known/oauth-authorization-server");
expect(body).toContain("/api/docs");
});
test("/.well-known/llms.txt serves the same agent map", async () => {
const a = await (await app.request("/llms.txt")).text();
const b = await (await app.request("/.well-known/llms.txt")).text();
expect(b).toBe(a);
expect(b.length).toBeGreaterThan(100);
});
|