From f550bea7ac0f5492b225996fdeeddbfc8928963d Mon Sep 17 00:00:00 2001 From: m4air Date: Tue, 15 Sep 2026 18:17:15 -0700 Subject: [PATCH] test(renderer): cover parked worktree intent cleanup --- ...minal-parked-watcher-reconciliation.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.test.ts b/src/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.test.ts index 84004997022..f92d34c00a6 100644 --- a/src/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-parked-watcher-reconciliation.test.ts @@ -1,6 +1,7 @@ import { afterEach, describe, expect, it } from 'vitest' import { captureParkedTerminalPaneCandidates, + pruneParkedTerminalWatchers, retireParkedTerminalTab } from './terminal-parked-watcher-registry' import { @@ -107,6 +108,23 @@ it('releases captured scroll-intent keys when a parked tab is closed', () => { expect(readTerminalScrollIntentKeyRetention().intents).toBe(0) }) +it('releases captured scroll-intent keys when a parked worktree is removed', () => { + writeKeyedTerminalScrollIntent(SECOND_LEAF_ID, { + kind: 'pinnedViewport', + bufferType: 'normal', + viewportY: 8, + baseY: 16, + revision: 1 + }) + captureParkedTerminalPaneCandidates(TAB_ID, WORKTREE_ID, [ + { ptyId: FIRST_PTY_ID, paneId: 1, leafId: SECOND_LEAF_ID, drivesTabTitle: true } + ]) + + pruneParkedTerminalWatchers(new Set()) + + expect(readTerminalScrollIntentKeyRetention().intents).toBe(0) +}) + // Why: the sole-newborn parity flag is a fact about the captured PTY, so the // layout-fallback rescue must carry it only while the leaf still binds that PTY. describe('untouchedFreshSpawn carry through the layout-fallback rescue', () => {