From 62b844def2a85817fe925a16abbed3bf316bfa54 Mon Sep 17 00:00:00 2001 From: Brennan Benson Date: Mon, 27 Jul 2026 06:35:19 -0700 Subject: [PATCH] test(worktrees): cover the desynced-global edge of setActiveTabTypeForWorktree --- .../slices/background-worktree-launch-focus.test.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/renderer/src/store/slices/background-worktree-launch-focus.test.ts b/src/renderer/src/store/slices/background-worktree-launch-focus.test.ts index 4c952d99b47..44601b281e6 100644 --- a/src/renderer/src/store/slices/background-worktree-launch-focus.test.ts +++ b/src/renderer/src/store/slices/background-worktree-launch-focus.test.ts @@ -60,6 +60,16 @@ describe('setActiveTabTypeForWorktree', () => { expect(store.getState()).toBe(before) }) + it('still fixes a desynced global when the viewed target is already stamped', () => { + const store = createStoreViewing('wt-a') + // Remembered type already matches, but the visible pane disagrees. + store.setState({ activeTabType: 'editor', activeTabTypeByWorktree: { 'wt-a': 'terminal' } }) + + store.getState().setActiveTabTypeForWorktree('wt-a', 'terminal') + + expect(store.getState().activeTabType).toBe('terminal') + }) + it('leaves the viewed pane alone when a background target is already stamped', () => { const store = createStoreViewing('wt-b') store.setState({ activeTabType: 'editor', activeTabTypeByWorktree: { 'wt-a': 'terminal' } })