From 65b29e3757dfbc801a72dd0257bc30b3b533da75 Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Sun, 15 Mar 2026 02:15:10 -0700 Subject: [PATCH] test: remove duplicate and theatrical tests (#2646) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - security.test.ts: remove "should handle prompt with only whitespace" (line 614) — fully covered by "should reject empty prompts" (line 363) which already tests validatePrompt(" ") and validatePrompt("\n\t") - script-failure-guidance.test.ts: consolidate three separate "returns simple command" tests (no-arg, undefined, empty string) into one. All three called buildRetryCommand with absent/falsy prompt and asserted identical output — the input variation is not a meaningful behavioral distinction. net: 3 tests removed. 1410 pass, 0 fail. biome lint clean. Co-authored-by: spawn-qa-bot Co-authored-by: Claude Sonnet 4.6 Co-authored-by: L <6723574+louisgv@users.noreply.github.com> --- .../src/__tests__/script-failure-guidance.test.ts | 12 +++--------- packages/cli/src/__tests__/security.test.ts | 4 ---- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/packages/cli/src/__tests__/script-failure-guidance.test.ts b/packages/cli/src/__tests__/script-failure-guidance.test.ts index 34180ef9..00b1b651 100644 --- a/packages/cli/src/__tests__/script-failure-guidance.test.ts +++ b/packages/cli/src/__tests__/script-failure-guidance.test.ts @@ -401,8 +401,10 @@ describe("getSignalGuidance", () => { }); describe("buildRetryCommand", () => { - it("should return simple command without prompt", () => { + it("should return simple command when prompt is absent, undefined, or empty", () => { expect(buildRetryCommand("claude", "sprite")).toBe("spawn claude sprite"); + expect(buildRetryCommand("codex", "vultr", undefined)).toBe("spawn codex vultr"); + expect(buildRetryCommand("codex", "vultr", "")).toBe("spawn codex vultr"); }); it("should include --prompt when prompt is provided", () => { @@ -434,14 +436,6 @@ describe("buildRetryCommand", () => { expect(result).toBe('spawn claude sprite --prompt "Fix \\"all\\" bugs"'); }); - it("should return simple command when prompt is undefined", () => { - expect(buildRetryCommand("codex", "vultr", undefined)).toBe("spawn codex vultr"); - }); - - it("should return simple command when prompt is empty string", () => { - expect(buildRetryCommand("codex", "vultr", "")).toBe("spawn codex vultr"); - }); - // ── spawnName parameter (issue #1709) ──────────────────────────────────── it("should include --name flag when spawnName is provided without prompt", () => { diff --git a/packages/cli/src/__tests__/security.test.ts b/packages/cli/src/__tests__/security.test.ts index 0dc55ef7..d2da3442 100644 --- a/packages/cli/src/__tests__/security.test.ts +++ b/packages/cli/src/__tests__/security.test.ts @@ -610,8 +610,4 @@ describe("validatePrompt", () => { it("should accept semicolons not followed by rm", () => { expect(() => validatePrompt("echo hello; echo world")).not.toThrow(); }); - - it("should handle prompt with only whitespace", () => { - expect(() => validatePrompt(" \t\n ")).toThrow("Prompt is required but was not provided"); - }); });