test(renderer): cover parked worktree intent cleanup

This commit is contained in:
m4air
2026-09-15 18:17:15 -07:00
parent 21501cac2b
commit f550bea7ac
@@ -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', () => {