test: remove duplicate and theatrical tests (#2700)

- 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 <qa@openrouter.ai>
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
This commit is contained in:
A 2026-03-16 20:12:47 -07:00 committed by GitHub
parent 5b2eddb763
commit 8dd1db7fbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 35 deletions

View file

@ -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;

View file

@ -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", [

View file

@ -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);
}
});
});