From 9bc8237f7bdb23d87edeb900e39f0293b0959468 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 8 May 2026 21:26:50 +0100 Subject: [PATCH] test: avoid filter allocation assertions --- src/agents/sandbox/fs-bridge.shell.test.ts | 8 ++++---- src/channels/status-reactions.test.ts | 2 +- src/infra/restart-stale-pids.test.ts | 2 +- src/secrets/apply.test.ts | 2 +- test/scripts/bundled-plugin-build-entries.test.ts | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/agents/sandbox/fs-bridge.shell.test.ts b/src/agents/sandbox/fs-bridge.shell.test.ts index 1fd440266c9..db29883896c 100644 --- a/src/agents/sandbox/fs-bridge.shell.test.ts +++ b/src/agents/sandbox/fs-bridge.shell.test.ts @@ -13,11 +13,11 @@ import { } from "./fs-bridge.test-helpers.js"; function expectNoScriptsContaining(scripts: string[], needle: string) { - expect(scripts.filter((script) => script.includes(needle))).toEqual([]); + expect(scripts.some((script) => script.includes(needle))).toBe(false); } function expectSomeScriptContaining(scripts: string[], needle: string) { - expect(scripts.filter((script) => script.includes(needle)).length).toBeGreaterThan(0); + expect(scripts.some((script) => script.includes(needle))).toBe(true); } describe("sandbox fs bridge shell compatibility", () => { @@ -49,8 +49,8 @@ describe("sandbox fs bridge shell compatibility", () => { const scripts = getScriptsFromCalls(); const executables = mockedExecDockerRaw.mock.calls.map(([args]) => args[3] ?? ""); - expect(executables.filter((shell) => shell !== "sh")).toEqual([]); - expect(scripts.filter((script) => !/set -eu[;\n]/.test(script))).toEqual([]); + expect(executables.every((shell) => shell === "sh")).toBe(true); + expect(scripts.every((script) => /set -eu[;\n]/.test(script))).toBe(true); expectNoScriptsContaining(scripts, "pipefail"); }); }); diff --git a/src/channels/status-reactions.test.ts b/src/channels/status-reactions.test.ts index 884a1c2a9ed..d5832699d64 100644 --- a/src/channels/status-reactions.test.ts +++ b/src/channels/status-reactions.test.ts @@ -373,7 +373,7 @@ describe("createStatusReactionController", () => { // Should only have set calls, no remove const removeCalls = calls.filter((c) => c.method === "remove"); expect(removeCalls).toHaveLength(0); - expect(calls.filter((c) => c.method === "set").length).toBeGreaterThan(0); + expect(calls.some((c) => c.method === "set")).toBe(true); }); it("should clear all known emojis when adapter supports removeReaction", async () => { diff --git a/src/infra/restart-stale-pids.test.ts b/src/infra/restart-stale-pids.test.ts index aab2ab6c84f..5b938a1e0be 100644 --- a/src/infra/restart-stale-pids.test.ts +++ b/src/infra/restart-stale-pids.test.ts @@ -759,7 +759,7 @@ describe.skipIf(isWindows)("restart-stale-pids", () => { cleanStaleGatewayProcessesSync(); expect(events).toContain("port-free"); - expect(events.filter((e) => e.startsWith("busy-poll")).length).toBeGreaterThan(0); + expect(events.some((e) => e.startsWith("busy-poll"))).toBe(true); }); it("bails immediately when lsof is permanently unavailable (ENOENT) — Greptile edge case", () => { diff --git a/src/secrets/apply.test.ts b/src/secrets/apply.test.ts index 2ec760ed4b4..b7355d02148 100644 --- a/src/secrets/apply.test.ts +++ b/src/secrets/apply.test.ts @@ -385,7 +385,7 @@ describe("secrets apply", () => { expect(dryRunAllowed.mode).toBe("dry-run"); expect(dryRunAllowed.skippedExecRefs).toBe(0); const callLog = await fs.readFile(execLogPath, "utf8"); - expect(callLog.split("\n").filter((line) => line.trim().length > 0).length).toBeGreaterThan(0); + expect(callLog.split("\n").some((line) => line.trim().length > 0)).toBe(true); }); it("ignores unrelated auth-profile store refs during allowExec dry-run preflight", async () => { diff --git a/test/scripts/bundled-plugin-build-entries.test.ts b/test/scripts/bundled-plugin-build-entries.test.ts index 18fbaa7d19c..27208097301 100644 --- a/test/scripts/bundled-plugin-build-entries.test.ts +++ b/test/scripts/bundled-plugin-build-entries.test.ts @@ -8,11 +8,11 @@ import { } from "../../scripts/lib/bundled-plugin-build-entries.mjs"; function expectNoPrefixMatches(values: string[], prefix: string) { - expect(values.filter((value) => value.startsWith(prefix))).toEqual([]); + expect(values.some((value) => value.startsWith(prefix))).toBe(false); } function expectSomePrefixMatch(values: string[], prefix: string) { - expect(values.filter((value) => value.startsWith(prefix)).length).toBeGreaterThan(0); + expect(values.some((value) => value.startsWith(prefix))).toBe(true); } describe("bundled plugin build entries", () => {