test(worktrees): cover the desynced-global edge of setActiveTabTypeForWorktree

This commit is contained in:
Brennan Benson
2026-07-27 06:37:41 -07:00
parent b20e489d81
commit 62b844def2
@@ -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' } })