From 83eb9e053e73260331aca84a239283e6ce3cf74b Mon Sep 17 00:00:00 2001 From: JSONbored <49853598+JSONbored@users.noreply.github.com> Date: Thu, 25 Jun 2026 04:48:31 -0700 Subject: [PATCH] test(review): cover planner AI-Gateway route + title/body fallbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restores the two planner.ts branches (the AI_GATEWAY_ID ternary and the title/description fallback strings) that the #1360 merge missed when its head ref was stuck on the pre-fix commit. Test-only — no src change. --- test/unit/planner.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/unit/planner.test.ts b/test/unit/planner.test.ts index 60191ec04b..60973b69cd 100644 --- a/test/unit/planner.test.ts +++ b/test/unit/planner.test.ts @@ -40,6 +40,15 @@ describe("generateIssuePlan (#issue-coding-plan)", () => { expect(userMessage).toContain("We need a config flag."); }); + it("covers the title/body fallbacks and routes through the AI Gateway when configured", async () => { + const run = vi.fn(async () => ({ response: "plan" })); + const env = createTestEnv({ AI: { run } as unknown as Ai, AI_GATEWAY_ID: "gw-1" }); + expect(await generateIssuePlan(env, { title: "only a title", body: "" })).toBe("plan"); // body fallback + expect(await generateIssuePlan(env, { title: "", body: "only a body" })).toBe("plan"); // title fallback + // the configured gateway id is threaded as the 3rd run() arg + expect((run.mock.calls[0] as unknown as unknown[])[2]).toEqual({ gateway: { id: "gw-1" } }); + }); + it("returns null when there is no issue text to plan from (no AI call)", async () => { const run = vi.fn(async () => ({ response: "x" })); const env = createTestEnv({ AI: { run } as unknown as Ai });