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

spec-to-pr.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.

spec-to-pr.test.tsBlame42 lines · 1 contributor
14c3cc8Claude1import { describe, it, expect, afterEach } from "bun:test";
2import { createSpecPR } from "../lib/spec-to-pr";
3
23d1a81Claude4/**
5 * The real pipeline (context → AI → git → PR insert) lives in
6 * `spec-context`, `spec-ai`, and `spec-git` tests. Here we only cover the
7 * fail-fast guards that don't require DB/disk/AI.
8 */
14c3cc8Claude9describe("createSpecPR", () => {
10 const originalKey = process.env.ANTHROPIC_API_KEY;
11
12 afterEach(() => {
13 if (originalKey === undefined) delete process.env.ANTHROPIC_API_KEY;
14 else process.env.ANTHROPIC_API_KEY = originalKey;
15 });
16
17 it("returns ok:false when ANTHROPIC_API_KEY is missing", async () => {
18 delete process.env.ANTHROPIC_API_KEY;
23d1a81Claude19 const result = await createSpecPR({
20 repoId: "00000000-0000-0000-0000-000000000000",
21 spec: "test",
22 userId: "00000000-0000-0000-0000-000000000000",
23 });
14c3cc8Claude24 expect(result.ok).toBe(false);
23d1a81Claude25 if (!result.ok) {
26 expect(result.error).toContain("ANTHROPIC_API_KEY");
27 }
14c3cc8Claude28 });
29
23d1a81Claude30 it("returns ok:false when spec is empty", async () => {
14c3cc8Claude31 process.env.ANTHROPIC_API_KEY = "fake-key-for-testing";
23d1a81Claude32 const result = await createSpecPR({
33 repoId: "00000000-0000-0000-0000-000000000000",
34 spec: " ",
35 userId: "00000000-0000-0000-0000-000000000000",
36 });
14c3cc8Claude37 expect(result.ok).toBe(false);
23d1a81Claude38 if (!result.ok) {
39 expect(result.error).toContain("empty");
40 }
14c3cc8Claude41 });
42});