From 2ed94a08c07f2509d30aa53f7dc1287195176679 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 22 Feb 2026 17:35:14 +0000 Subject: [PATCH] test: merge duplicate bash background session-name coverage --- src/agents/bash-tools.test.ts | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/src/agents/bash-tools.test.ts b/src/agents/bash-tools.test.ts index ee0de5e7a58..2d16f6e7f7b 100644 --- a/src/agents/bash-tools.test.ts +++ b/src/agents/bash-tools.test.ts @@ -147,9 +147,9 @@ describe("exec tool backgrounding", () => { isWin ? 15_000 : 5_000, ); - it("supports explicit background", async () => { + it("supports explicit background and derives session name from the command", async () => { const result = await execTool.execute("call1", { - command: echoAfterDelay("later"), + command: "echo hello", background: true, }); @@ -157,28 +157,10 @@ describe("exec tool backgrounding", () => { const sessionId = (result.details as { sessionId: string }).sessionId; const list = await processTool.execute("call2", { action: "list" }); - const sessions = (list.details as { sessions: Array<{ sessionId: string }> }).sessions; + const sessions = (list.details as { sessions: Array<{ sessionId: string; name?: string }> }) + .sessions; expect(sessions.some((s) => s.sessionId === sessionId)).toBe(true); - }); - - it("derives a session name from the command", async () => { - const result = await execTool.execute("call1", { - command: "echo hello", - background: true, - }); - const sessionId = (result.details as { sessionId: string }).sessionId; - await expect - .poll( - async () => { - const list = await processTool.execute("call2", { action: "list" }); - const sessions = ( - list.details as { sessions: Array<{ sessionId: string; name?: string }> } - ).sessions; - return sessions.find((s) => s.sessionId === sessionId)?.name; - }, - { timeout: process.platform === "win32" ? 8000 : 1200, interval: POLL_INTERVAL_MS }, - ) - .toBe("echo hello"); + expect(sessions.find((s) => s.sessionId === sessionId)?.name).toBe("echo hello"); }); it("uses default timeout when timeout is omitted", async () => {