mirror of
https://github.com/bendtherules/opencode-multi-model.git
synced 2026-08-18 13:42:21 +00:00
fix: use sessionName instead of safeSessionName in tmux commands
This commit is contained in:
@@ -221,6 +221,23 @@ describe("closeMultiModel", () => {
|
||||
expect(executedCommands).toContain(`git branch -D opencode/${sanitized}/model`);
|
||||
});
|
||||
|
||||
test("tmux commands use sessionName, not safeSessionName", async () => {
|
||||
const unsanitized = "my session!";
|
||||
const sanitized = "my-session";
|
||||
mockCommandResponses[`tmux has-session -t ${unsanitized}`] = { ok: true, stdout: "", stderr: "" };
|
||||
mockCommandResponses[`tmux kill-session -t ${unsanitized}`] = { ok: true, stdout: "", stderr: "" };
|
||||
// No worktrees
|
||||
mockCommandResponses["git worktree list --porcelain"] = { ok: true, stdout: "", stderr: "" };
|
||||
|
||||
const result = await closeMultiModel({ sessionName: unsanitized, cleanupWorktrees: false, force: false });
|
||||
expect(result.success).toBe(true);
|
||||
// Verify tmux commands used unsanitized name
|
||||
expect(executedCommands).toContain(`tmux has-session -t ${unsanitized}`);
|
||||
expect(executedCommands).toContain(`tmux kill-session -t ${unsanitized}`);
|
||||
// Ensure sanitized name not used in tmux commands
|
||||
expect(executedCommands.some(c => c.includes(`-t ${sanitized}`))).toBe(false);
|
||||
});
|
||||
|
||||
test("skip archive tags when flag disabled", async () => {
|
||||
mockCommandResponses["tmux has-session -t test-session"] = { ok: false, stdout: "", stderr: "" };
|
||||
const worktreePath = "/home/user/.local/share/opencode/multi-model/test-session/model";
|
||||
|
||||
Reference in New Issue
Block a user