Skip to content

Commit a8e6364

Browse files
la14-1spawn-qa-botlouisgv
authored
test: remove duplicate and theatrical tests in spawn-skill (#3027)
Consolidate 15 repetitive it() blocks in spawn-skill.test.ts into data-driven table tests: - getSpawnSkillPath: 8 separate 'returns correct path for X' tests collapsed into one table-driven it() iterating all 8 agent/path pairs - isAppendMode: 7 separate 'returns false for X' tests (one per non-hermes agent) collapsed into a single loop-based it() — all tested the same code path with the same expected value Coverage is unchanged: all agent/path pairs are still asserted, the hermes=true case and the nonexistent=undefined case are preserved as individual tests. Test count drops from 45 to 30 in this file. Co-authored-by: spawn-qa-bot <qa@openrouter.ai> Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
1 parent c61736e commit a8e6364

1 file changed

Lines changed: 57 additions & 56 deletions

File tree

packages/cli/src/__tests__/spawn-skill.test.ts

Lines changed: 57 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,50 @@ import { getSkillContent, getSpawnSkillPath, injectSpawnSkill, isAppendMode } fr
44
// ─── Path mapping tests ─────────────────────────────────────────────────────
55

66
describe("getSpawnSkillPath", () => {
7-
it("returns correct path for claude", () => {
8-
expect(getSpawnSkillPath("claude")).toBe("~/.claude/skills/spawn/SKILL.md");
9-
});
10-
11-
it("returns correct path for codex", () => {
12-
expect(getSpawnSkillPath("codex")).toBe("~/.agents/skills/spawn/SKILL.md");
13-
});
14-
15-
it("returns correct path for openclaw", () => {
16-
expect(getSpawnSkillPath("openclaw")).toBe("~/.openclaw/skills/spawn/SKILL.md");
17-
});
18-
19-
it("returns correct path for zeroclaw", () => {
20-
expect(getSpawnSkillPath("zeroclaw")).toBe("~/.zeroclaw/workspace/AGENTS.md");
21-
});
22-
23-
it("returns correct path for opencode", () => {
24-
expect(getSpawnSkillPath("opencode")).toBe("~/.config/opencode/AGENTS.md");
25-
});
26-
27-
it("returns correct path for kilocode", () => {
28-
expect(getSpawnSkillPath("kilocode")).toBe("~/.kilocode/rules/spawn.md");
29-
});
30-
31-
it("returns correct path for hermes", () => {
32-
expect(getSpawnSkillPath("hermes")).toBe("~/.hermes/SOUL.md");
33-
});
7+
const expectedPaths: Array<
8+
[
9+
string,
10+
string,
11+
]
12+
> = [
13+
[
14+
"claude",
15+
"~/.claude/skills/spawn/SKILL.md",
16+
],
17+
[
18+
"codex",
19+
"~/.agents/skills/spawn/SKILL.md",
20+
],
21+
[
22+
"openclaw",
23+
"~/.openclaw/skills/spawn/SKILL.md",
24+
],
25+
[
26+
"zeroclaw",
27+
"~/.zeroclaw/workspace/AGENTS.md",
28+
],
29+
[
30+
"opencode",
31+
"~/.config/opencode/AGENTS.md",
32+
],
33+
[
34+
"kilocode",
35+
"~/.kilocode/rules/spawn.md",
36+
],
37+
[
38+
"hermes",
39+
"~/.hermes/SOUL.md",
40+
],
41+
[
42+
"junie",
43+
"~/.junie/AGENTS.md",
44+
],
45+
];
3446

35-
it("returns correct path for junie", () => {
36-
expect(getSpawnSkillPath("junie")).toBe("~/.junie/AGENTS.md");
47+
it("returns correct remote path for each known agent", () => {
48+
for (const [agent, expectedPath] of expectedPaths) {
49+
expect(getSpawnSkillPath(agent), `agent "${agent}"`).toBe(expectedPath);
50+
}
3751
});
3852

3953
it("returns undefined for unknown agent", () => {
@@ -44,36 +58,23 @@ describe("getSpawnSkillPath", () => {
4458
// ─── Append mode tests ──────────────────────────────────────────────────────
4559

4660
describe("isAppendMode", () => {
47-
it("returns true for hermes", () => {
61+
it("returns true only for hermes (appends to SOUL.md)", () => {
4862
expect(isAppendMode("hermes")).toBe(true);
4963
});
5064

51-
it("returns false for claude", () => {
52-
expect(isAppendMode("claude")).toBe(false);
53-
});
54-
55-
it("returns false for codex", () => {
56-
expect(isAppendMode("codex")).toBe(false);
57-
});
58-
59-
it("returns false for openclaw", () => {
60-
expect(isAppendMode("openclaw")).toBe(false);
61-
});
62-
63-
it("returns false for zeroclaw", () => {
64-
expect(isAppendMode("zeroclaw")).toBe(false);
65-
});
66-
67-
it("returns false for opencode", () => {
68-
expect(isAppendMode("opencode")).toBe(false);
69-
});
70-
71-
it("returns false for kilocode", () => {
72-
expect(isAppendMode("kilocode")).toBe(false);
73-
});
74-
75-
it("returns false for junie", () => {
76-
expect(isAppendMode("junie")).toBe(false);
65+
it("returns false for all non-hermes agents", () => {
66+
const overwriteAgents = [
67+
"claude",
68+
"codex",
69+
"openclaw",
70+
"zeroclaw",
71+
"opencode",
72+
"kilocode",
73+
"junie",
74+
];
75+
for (const agent of overwriteAgents) {
76+
expect(isAppendMode(agent), `agent "${agent}"`).toBe(false);
77+
}
7778
});
7879
});
7980

0 commit comments

Comments
 (0)