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

demo-seed.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.

demo-seed.test.tsBlame87 lines · 1 contributor
988380aClaude1/**
2 * Pure-helper tests for src/lib/demo-seed.ts. We never touch the DB here —
3 * the content builders and DEMO_USERNAME constant are fully deterministic
4 * and are the only bits exercised.
5 */
6
7import { describe, it, expect } from "bun:test";
8import {
9 DEMO_USERNAME,
10 buildHelloPythonFiles,
11 buildTodoApiFiles,
12 buildDesignDocsFiles,
13 __test,
14} from "../lib/demo-seed";
15
16describe("DEMO_USERNAME", () => {
17 it('equals "demo"', () => {
18 expect(DEMO_USERNAME).toBe("demo");
19 });
20});
21
22describe("buildHelloPythonFiles", () => {
23 const files = buildHelloPythonFiles();
24
25 it("returns a non-empty record with the expected filenames", () => {
26 const keys = Object.keys(files);
27 expect(keys.length).toBeGreaterThan(0);
28 expect(keys).toContain("README.md");
29 expect(keys).toContain("main.py");
30 expect(keys).toContain("requirements.txt");
31 });
32
33 it("README.md mentions the repo name", () => {
34 expect(files["README.md"]).toContain("hello-python");
35 });
36
37 it("main.py is non-empty", () => {
38 expect(files["main.py"].length).toBeGreaterThan(0);
39 expect(files["main.py"]).toContain("def ");
40 });
41});
42
43describe("buildTodoApiFiles", () => {
44 const files = buildTodoApiFiles();
45
46 it("returns a non-empty record with the expected filenames", () => {
47 const keys = Object.keys(files);
48 expect(keys.length).toBeGreaterThan(0);
49 expect(keys).toContain("README.md");
50 expect(keys).toContain("package.json");
51 expect(keys).toContain("src/index.ts");
52 });
53
54 it("README.md mentions the repo name", () => {
55 expect(files["README.md"]).toContain("todo-api");
56 });
57
58 it("package.json is valid JSON", () => {
59 expect(() => JSON.parse(files["package.json"])).not.toThrow();
60 const parsed = JSON.parse(files["package.json"]);
61 expect(parsed.name).toBe("todo-api");
62 });
63});
64
65describe("buildDesignDocsFiles", () => {
66 const files = buildDesignDocsFiles();
67
68 it("returns a non-empty record with the expected filenames", () => {
69 const keys = Object.keys(files);
70 expect(keys.length).toBeGreaterThan(0);
71 expect(keys).toContain("README.md");
72 expect(keys).toContain("docs/architecture.md");
73 expect(keys).toContain("docs/adr-001.md");
74 });
75
76 it("README.md mentions the repo name", () => {
77 expect(files["README.md"]).toContain("design-docs");
78 });
79});
80
81describe("__test bundle", () => {
82 it("re-exports the three content builders", () => {
83 expect(typeof __test.buildHelloPythonFiles).toBe("function");
84 expect(typeof __test.buildTodoApiFiles).toBe("function");
85 expect(typeof __test.buildDesignDocsFiles).toBe("function");
86 });
87});