test(tmux): align pane replace placeholder expectations
This commit is contained in:
@@ -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("\\$")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user