From 8dd1db7fbb95aefc554654be2c4fedd0046d1a07 Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Mon, 16 Mar 2026 20:12:47 -0700 Subject: [PATCH] test: remove duplicate and theatrical tests (#2700) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove 2-test "flag registration" block from custom-flag.test.ts — both assertions (KNOWN_FLAGS.has("--custom") and findUnknownFlag returning null) were already covered by the KNOWN_FLAGS completeness test in unknown-flags.test.ts. - Fix stale KNOWN_FLAGS completeness test: it was testing only 18 of 26 known flags, making it always-pass when new flags are added to flags.ts without updating the test. Now the test is bidirectionally exhaustive — every flag in the expected list must be in KNOWN_FLAGS, and every flag in KNOWN_FLAGS must be in the expected list. This absorbs the --steps/--config coverage. - Remove findUnknownFlag(["--steps"]) / findUnknownFlag(["--config"]) test from steps-flag.test.ts — now redundant since the exhaustive completeness test already exercises those flags. Net: -3 tests removed, +18 expect() calls added (exhaustive bidirectional check). Co-authored-by: spawn-qa-bot Co-authored-by: L <6723574+louisgv@users.noreply.github.com> --- .../cli/src/__tests__/custom-flag.test.ts | 19 ------------------- packages/cli/src/__tests__/steps-flag.test.ts | 16 ---------------- .../cli/src/__tests__/unknown-flags.test.ts | 17 +++++++++++++++++ 3 files changed, 17 insertions(+), 35 deletions(-) diff --git a/packages/cli/src/__tests__/custom-flag.test.ts b/packages/cli/src/__tests__/custom-flag.test.ts index 3d451e0f..ebff7058 100644 --- a/packages/cli/src/__tests__/custom-flag.test.ts +++ b/packages/cli/src/__tests__/custom-flag.test.ts @@ -1,23 +1,4 @@ import { afterEach, describe, expect, it } from "bun:test"; -import { findUnknownFlag, KNOWN_FLAGS } from "../flags"; - -describe("--custom flag", () => { - describe("flag registration", () => { - it("should be in KNOWN_FLAGS", () => { - expect(KNOWN_FLAGS.has("--custom")).toBe(true); - }); - - it("should not be detected as unknown flag", () => { - expect( - findUnknownFlag([ - "claude", - "sprite", - "--custom", - ]), - ).toBeNull(); - }); - }); -}); describe("AWS --custom prompts", () => { const savedCustom = process.env.SPAWN_CUSTOM; diff --git a/packages/cli/src/__tests__/steps-flag.test.ts b/packages/cli/src/__tests__/steps-flag.test.ts index 3c5ba9ac..5f451312 100644 --- a/packages/cli/src/__tests__/steps-flag.test.ts +++ b/packages/cli/src/__tests__/steps-flag.test.ts @@ -1,22 +1,6 @@ import { describe, expect, it } from "bun:test"; -import { findUnknownFlag } from "../flags"; import { getAgentOptionalSteps, validateStepNames } from "../shared/agents"; -describe("--steps and --config flags", () => { - it("should recognize --steps and --config as known flags", () => { - expect( - findUnknownFlag([ - "--steps", - ]), - ).toBeNull(); - expect( - findUnknownFlag([ - "--config", - ]), - ).toBeNull(); - }); -}); - describe("validateStepNames", () => { it("should validate known steps for claude", () => { const { valid, invalid } = validateStepNames("claude", [ diff --git a/packages/cli/src/__tests__/unknown-flags.test.ts b/packages/cli/src/__tests__/unknown-flags.test.ts index 126ae8c1..3805742e 100644 --- a/packages/cli/src/__tests__/unknown-flags.test.ts +++ b/packages/cli/src/__tests__/unknown-flags.test.ts @@ -189,6 +189,7 @@ describe("Unknown Flag Detection", () => { describe("KNOWN_FLAGS completeness", () => { it("should contain all expected flags", () => { + // This list must match flags.ts exactly — add here whenever KNOWN_FLAGS grows. const expected = [ "--help", "-h", @@ -213,12 +214,28 @@ describe("KNOWN_FLAGS completeness", () => { "--clear", "--custom", "--reauth", + "--zone", + "--region", + "--machine-type", + "--size", "--prune", "--json", + "--beta", + "--model", + "-m", + "--config", + "--steps", + "--user", + "-u", ]; + // Every flag in the expected list must exist in KNOWN_FLAGS. for (const flag of expected) { expect(KNOWN_FLAGS.has(flag)).toBe(true); } + // Every flag in KNOWN_FLAGS must be in the expected list — catches silent additions. + for (const flag of KNOWN_FLAGS) { + expect(expected).toContain(flag); + } }); });