CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
status-seo.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.
| 9b07ca9 | 1 | /** |
| 2 | * Smoke tests for the public /status page, /status.svg badge, and SEO | |
| 3 | * routes (/robots.txt + /sitemap.xml). These don't stub the DB — they | |
| 4 | * tolerate either success (dev DB reachable) or a graceful error page | |
| 5 | * so they work in the sandbox environment. | |
| 6 | */ | |
| 7 | ||
| 8 | import { test, expect } from "bun:test"; | |
| 9 | import app from "../app"; | |
| 10 | ||
| 11 | test("/status returns 200 with HTML body", async () => { | |
| 12 | const res = await app.request("/status"); | |
| 13 | expect(res.status).toBe(200); | |
| 14 | const body = await res.text(); | |
| 15 | expect(body).toContain("<html"); | |
| 16 | // Either the green or red headline should appear | |
| 17 | expect( | |
| 18 | body.includes("All systems operational") || | |
| 19 | body.includes("Service degraded") | |
| 20 | ).toBe(true); | |
| 21 | }); | |
| 22 | ||
| 23 | test("/status.svg returns an SVG badge", async () => { | |
| 24 | const res = await app.request("/status.svg"); | |
| 25 | expect(res.status).toBe(200); | |
| 26 | expect(res.headers.get("content-type")).toMatch(/image\/svg/); | |
| 27 | const body = await res.text(); | |
| 28 | expect(body).toContain("<svg"); | |
| 29 | expect(body).toContain("</svg>"); | |
| 30 | }); | |
| 31 | ||
| 32 | test("/robots.txt returns 200 with crawler directives", async () => { | |
| 33 | const res = await app.request("/robots.txt"); | |
| 34 | expect(res.status).toBe(200); | |
| 35 | expect(res.headers.get("content-type")).toMatch(/text\/plain/); | |
| 36 | const body = await res.text(); | |
| 37 | expect(body).toContain("User-agent:"); | |
| 38 | expect(body).toContain("Sitemap:"); | |
| 39 | expect(body).toContain("Disallow: /admin"); | |
| 40 | }); | |
| 41 | ||
| 42 | test("/sitemap.xml returns valid-looking XML", async () => { | |
| 43 | const res = await app.request("/sitemap.xml"); | |
| 44 | expect(res.status).toBe(200); | |
| 45 | expect(res.headers.get("content-type")).toMatch(/xml/); | |
| 46 | const body = await res.text(); | |
| 47 | expect(body).toContain('<?xml'); | |
| 48 | expect(body).toContain("<urlset"); | |
| 49 | expect(body).toContain("<loc>"); | |
| 50 | expect(body).toContain("</urlset>"); | |
| 51 | }); | |
| 52 | ||
| 53 | test("sitemap includes the landing, status, explore URLs", async () => { | |
| 54 | const res = await app.request("/sitemap.xml"); | |
| 55 | const body = await res.text(); | |
| 56 | expect(body).toMatch(/<loc>[^<]*\/<\/loc>/); | |
| 57 | expect(body).toContain("/status"); | |
| 58 | expect(body).toContain("/explore"); | |
| 59 | }); |