From c0e0d4c63d31f32bfc721a92d2d9eadb972b3458 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 18 Feb 2026 22:46:10 +0000 Subject: [PATCH] test: dedupe empty-array counter checks in sandbox formatters --- src/commands/sandbox-formatters.e2e.test.ts | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/commands/sandbox-formatters.e2e.test.ts b/src/commands/sandbox-formatters.e2e.test.ts index b9c4b70298e..b0aed042f05 100644 --- a/src/commands/sandbox-formatters.e2e.test.ts +++ b/src/commands/sandbox-formatters.e2e.test.ts @@ -91,10 +91,6 @@ describe("sandbox-formatters", () => { expect(countRunning(items)).toBe(2); }); - it("should return 0 for empty array", () => { - expect(countRunning([])).toBe(0); - }); - it("should return 0 when no items running", () => { const items = [ { running: false, name: "a" }, @@ -128,10 +124,6 @@ describe("sandbox-formatters", () => { expect(countMismatches(items)).toBe(3); }); - it("should return 0 for empty array", () => { - expect(countMismatches([])).toBe(0); - }); - it("should return 0 when all match", () => { const items = [ { imageMatch: true, name: "a" }, @@ -151,4 +143,13 @@ describe("sandbox-formatters", () => { expect(countMismatches(items)).toBe(3); }); }); + + describe("counter empty inputs", () => { + it.each([ + { fn: countRunning as (items: unknown[]) => number }, + { fn: countMismatches as (items: unknown[]) => number }, + ])("should return 0 for empty array", ({ fn }) => { + expect(fn([])).toBe(0); + }); + }); });