From 475a1772a7fc424a0480c48cfd5502fffbfc6452 Mon Sep 17 00:00:00 2001 From: A <258483684+la14-1@users.noreply.github.com> Date: Thu, 5 Mar 2026 04:51:52 -0800 Subject: [PATCH] test: Remove always-pass conditional guards in icon-integrity tests (#2214) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `if (parsed.success)` and `if (id in SOURCES)` guards inside test bodies were redundant — an `expect(...).toBe(true)` assertion always precedes them, so the inner expects would only be skipped if the test was already failing. Replace with early-return guards that make the control flow explicit and remove the nested indirection. Co-authored-by: spawn-qa-bot Co-authored-by: Claude Sonnet 4.6 --- .../cli/src/__tests__/icon-integrity.test.ts | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/packages/cli/src/__tests__/icon-integrity.test.ts b/packages/cli/src/__tests__/icon-integrity.test.ts index 90a18f1c..a5db9186 100644 --- a/packages/cli/src/__tests__/icon-integrity.test.ts +++ b/packages/cli/src/__tests__/icon-integrity.test.ts @@ -63,20 +63,23 @@ describe("Icon Integrity", () => { it(`${id} manifest icon URL ends with .png`, () => { const parsed = v.safeParse(IconEntry, manifest.agents[id]); expect(parsed.success).toBe(true); - if (parsed.success) { - expect(parsed.output.icon).toEndWith(`${id}.png`); + if (!parsed.success) { + return; } + expect(parsed.output.icon).toEndWith(`${id}.png`); }); it(`${id} .sources.json ext is "png"`, () => { expect(id in AGENT_SOURCES).toBe(true); - if (id in AGENT_SOURCES) { - const parsed = v.safeParse(SourceEntry, AGENT_SOURCES[id]); - expect(parsed.success).toBe(true); - if (parsed.success) { - expect(parsed.output.ext).toBe("png"); - } + if (!(id in AGENT_SOURCES)) { + return; } + const parsed = v.safeParse(SourceEntry, AGENT_SOURCES[id]); + expect(parsed.success).toBe(true); + if (!parsed.success) { + return; + } + expect(parsed.output.ext).toBe("png"); }); } @@ -111,13 +114,15 @@ describe("Icon Integrity", () => { it(`${id} .sources.json ext is "png"`, () => { expect(id in CLOUD_SOURCES).toBe(true); - if (id in CLOUD_SOURCES) { - const src = v.safeParse(SourceEntry, CLOUD_SOURCES[id]); - expect(src.success).toBe(true); - if (src.success) { - expect(src.output.ext).toBe("png"); - } + if (!(id in CLOUD_SOURCES)) { + return; } + const src = v.safeParse(SourceEntry, CLOUD_SOURCES[id]); + expect(src.success).toBe(true); + if (!src.success) { + return; + } + expect(src.output.ext).toBe("png"); }); }