CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
repo-lifecycle.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.
| 71cd5ec | 1 | /** |
| 2 | * Block I1+I2+I3 — Archive, template, transfer route auth smoke. | |
| 3 | * Also asserts the command palette payload is injected into Layout output. | |
| 4 | */ | |
| 5 | ||
| 6 | import { describe, it, expect } from "bun:test"; | |
| 7 | import app from "../app"; | |
| 8 | import { Layout } from "../views/layout"; | |
| 9 | ||
| 10 | describe("repo-lifecycle — archive", () => { | |
| 11 | it("POST /:owner/:repo/settings/archive without auth → 302 /login", async () => { | |
| 12 | const res = await app.request("/alice/repo/settings/archive", { | |
| 13 | method: "POST", | |
| 14 | body: new URLSearchParams({ archive: "1" }), | |
| 15 | headers: { "content-type": "application/x-www-form-urlencoded" }, | |
| 16 | }); | |
| 17 | expect(res.status).toBe(302); | |
| 18 | expect(res.headers.get("location") || "").toContain("/login"); | |
| 19 | }); | |
| 20 | }); | |
| 21 | ||
| 22 | describe("repo-lifecycle — template", () => { | |
| 23 | it("POST /:owner/:repo/settings/template without auth → 302 /login", async () => { | |
| 24 | const res = await app.request("/alice/repo/settings/template", { | |
| 25 | method: "POST", | |
| 26 | body: new URLSearchParams({ template: "1" }), | |
| 27 | headers: { "content-type": "application/x-www-form-urlencoded" }, | |
| 28 | }); | |
| 29 | expect(res.status).toBe(302); | |
| 30 | expect(res.headers.get("location") || "").toContain("/login"); | |
| 31 | }); | |
| 32 | ||
| 33 | it("POST /:owner/:repo/use-template without auth → 302 /login", async () => { | |
| 34 | const res = await app.request("/alice/repo/use-template", { | |
| 35 | method: "POST", | |
| 36 | body: new URLSearchParams({ name: "new-repo" }), | |
| 37 | headers: { "content-type": "application/x-www-form-urlencoded" }, | |
| 38 | }); | |
| 39 | expect(res.status).toBe(302); | |
| 40 | expect(res.headers.get("location") || "").toContain("/login"); | |
| 41 | }); | |
| 42 | }); | |
| 43 | ||
| 44 | describe("repo-lifecycle — transfer", () => { | |
| 45 | it("POST /:owner/:repo/settings/transfer without auth → 302 /login", async () => { | |
| 46 | const res = await app.request("/alice/repo/settings/transfer", { | |
| 47 | method: "POST", | |
| 48 | body: new URLSearchParams({ new_owner: "bob" }), | |
| 49 | headers: { "content-type": "application/x-www-form-urlencoded" }, | |
| 50 | }); | |
| 51 | expect(res.status).toBe(302); | |
| 52 | expect(res.headers.get("location") || "").toContain("/login"); | |
| 53 | }); | |
| 54 | }); | |
| 55 | ||
| 56 | describe("command palette — Layout markup", () => { | |
| 57 | it("renders cmdk-backdrop + cmdk-panel + cmdk-input in every layout", () => { | |
| 58 | const vnode = Layout({ title: "Test", children: "x" } as any); | |
| 59 | // vnode.toString() renders JSX to HTML in Hono's JSX runtime | |
| 60 | const html = String(vnode); | |
| 61 | expect(html).toContain("cmdk-backdrop"); | |
| 62 | expect(html).toContain("cmdk-panel"); | |
| 63 | expect(html).toContain("cmdk-input"); | |
| 64 | expect(html).toContain("cmdk-list"); | |
| 65 | }); | |
| 66 | ||
| 67 | it("command palette script registers COMMANDS list", () => { | |
| 68 | const vnode = Layout({ title: "Test", children: "x" } as any); | |
| 69 | const html = String(vnode); | |
| 70 | // Script body should mention some canonical destinations | |
| 71 | expect(html).toContain("Go to Dashboard"); | |
| 72 | expect(html).toContain("Marketplace"); | |
| 73 | expect(html).toContain("GraphQL explorer"); | |
| 74 | }); | |
| 75 | }); |