Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
CodeIssuesPull RequestsActionsSecurityInsightsSettings
✨ AI
More
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.tsBlame25 lines · 1 contributor
14c3cc8Claude1import { describe, it, expect, afterEach } from "bun:test";
2import { createSpecPR } from "../lib/spec-to-pr";
3
4describe("createSpecPR", () => {
5 const originalKey = process.env.ANTHROPIC_API_KEY;
6
7 afterEach(() => {
8 if (originalKey === undefined) delete process.env.ANTHROPIC_API_KEY;
9 else process.env.ANTHROPIC_API_KEY = originalKey;
10 });
11
12 it("returns ok:false when ANTHROPIC_API_KEY is missing", async () => {
13 delete process.env.ANTHROPIC_API_KEY;
14 const result = await createSpecPR({ repoId: 1, spec: "test", userId: 1 });
15 expect(result.ok).toBe(false);
16 expect(result.error).toContain("ANTHROPIC_API_KEY");
17 });
18
19 it("returns ok:false with a clear experimental notice when key is set", async () => {
20 process.env.ANTHROPIC_API_KEY = "fake-key-for-testing";
21 const result = await createSpecPR({ repoId: -999, spec: "test", userId: 1 });
22 expect(result.ok).toBe(false);
23 expect(result.error).toBeTruthy();
24 });
25});