From d02cca4422c4c2742d1dbc36ecfc6761507d42a9 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Sat, 16 May 2026 00:18:33 +0900 Subject: [PATCH] test(tmux): align pane replace placeholder expectations --- .../tmux/tmux-utils/pane-replace.test.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/shared/tmux/tmux-utils/pane-replace.test.ts b/src/shared/tmux/tmux-utils/pane-replace.test.ts index 57416a745..65dee7294 100644 --- a/src/shared/tmux/tmux-utils/pane-replace.test.ts +++ b/src/shared/tmux/tmux-utils/pane-replace.test.ts @@ -112,21 +112,23 @@ describe("replaceTmuxPane runner integration", () => { expect(sendKeysCall[1]).toEqual(["send-keys", "-t", "%42", "C-c"]) expect(respawnCall[1].slice(0, 4)).toEqual(["respawn-pane", "-k", "-t", "%42"]) expect(selectPaneCall[1]).toEqual(["select-pane", "-t", "%42", "-T", "omo-subagent-worker"]) - expect(getRespawnCommand()).toContain(` --dir '${directory}'`) + expect(getRespawnCommand()).toContain("Focus this pane to attach.") + expect(getRespawnCommand()).toContain("tail -f /dev/null") + expect(getRespawnCommand()).not.toContain("opencode attach") }) - it("#given directory with spaces #when replaceTmuxPane called #then wraps --dir value in single quotes", async () => { + it("#given description with spaces #when replaceTmuxPane called #then includes it in the placeholder", async () => { // given const replaceTmuxPane = await loadReplaceTmuxPane() // when - await replaceTmuxPane("%42", "session-1", "worker", enabledTmuxConfig, "http://127.0.0.1:1234", "/path with spaces/here", createDeps()) + await replaceTmuxPane("%42", "session-1", "worker with spaces", enabledTmuxConfig, "http://127.0.0.1:1234", "/path with spaces/here", createDeps()) // then - expect(getRespawnCommand()).toContain("--dir '/path with spaces/here'") + expect(getRespawnCommand()).toContain("OMO subagent pane ready: worker with spaces") }) - it("#given empty directory #when replaceTmuxPane called #then falls back to process cwd", async () => { + it("#given empty directory #when replaceTmuxPane called #then keeps the placeholder detached from attach", async () => { // given const replaceTmuxPane = await loadReplaceTmuxPane() @@ -134,17 +136,18 @@ describe("replaceTmuxPane runner integration", () => { await replaceTmuxPane("%42", "session-1", "worker", enabledTmuxConfig, "http://127.0.0.1:1234", "", createDeps()) // then - expect(getRespawnCommand()).toContain(`--dir '${process.cwd()}'`) + expect(getRespawnCommand()).not.toContain("--dir") }) - it("#given directory with single quotes #when replaceTmuxPane called #then escapes the value with POSIX-safe single quoting", async () => { + it("#given description with shell metacharacters #when replaceTmuxPane called #then escapes the placeholder", async () => { // given const replaceTmuxPane = await loadReplaceTmuxPane() // when - await replaceTmuxPane("%42", "session-1", "worker", enabledTmuxConfig, "http://127.0.0.1:1234", "/path/with'quote", createDeps()) + await replaceTmuxPane("%42", "session-1", 'worker "$(whoami)"', enabledTmuxConfig, "http://127.0.0.1:1234", "/path/with'quote", createDeps()) // then - expect(getRespawnCommand()).toContain("--dir '/path/with'\\''quote'") + expect(getRespawnCommand()).toContain('\\"') + expect(getRespawnCommand()).toContain("\\$") }) })