test: avoid misc count filter allocations

This commit is contained in:
Peter Steinberger
2026-05-08 22:05:41 +01:00
parent cd7f733a99
commit ce515dbf4d
10 changed files with 30 additions and 14 deletions

View File

@@ -582,7 +582,12 @@ describe("runCli exit behavior", () => {
try {
const runPromise = runCli(["node", "openclaw", "plugins", "marketplace", "list"]);
await vi.waitFor(() => {
expect(processOnceSpy.mock.calls.filter(([event]) => event === "exit")).toHaveLength(2);
expect(
processOnceSpy.mock.calls.reduce(
(count, [event]) => count + (event === "exit" ? 1 : 0),
0,
),
).toBe(2);
});
const exitHandler = processOnceSpy.mock.calls.find(([event]) => event === "exit")?.[1];