From bbc35c1a9865e6d41b3bd2d3e45724485aee29ac Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Tue, 27 Oct 2026 00:54:59 -0700 Subject: [PATCH] test: remove 30 low-value cases and 11 suites (#34288) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- config/scripts/ci-shard-timings.json | 11 ---- .../wsl-hook-relay-stop-settle.test.ts | 2 +- .../worktree-palette-cache-inputs.test.ts | 42 ------------ .../editor/editor-file-save-attempt.test.ts | 8 --- .../right-sidebar/file-explorer-reset.test.ts | 53 --------------- ...minal-pane-manager-options-persist.test.ts | 43 ------------- .../terminal-pty-paste-writer.test.ts | 44 ------------- .../terminal-url-link-hit-testing.test.ts | 21 +----- .../use-visible-terminal-tab-claim.test.ts | 54 ---------------- .../terminal-search-safe-find.test.ts | 7 -- .../wsl-account-notice-ipc-bridge.test.ts | 50 --------------- .../src/hooks/usePrefersReducedMotion.test.ts | 43 ------------- .../pane-layout-change-notify.test.ts | 45 ------------- .../src/lib/plugin-command-execution.test.ts | 54 ---------------- ...nal-shortcut-capture-notification.test.tsx | 64 ------------------- .../remote-restore-spawn-intent.test.ts | 5 -- .../runtime-provisioned-root-adoption.test.ts | 49 -------------- .../remote-runtime-pty-id.test.ts | 19 +----- 18 files changed, 3 insertions(+), 611 deletions(-) delete mode 100644 src/renderer/src/components/cmd-j/worktree-palette-cache-inputs.test.ts delete mode 100644 src/renderer/src/components/right-sidebar/file-explorer-reset.test.ts delete mode 100644 src/renderer/src/components/terminal-pane/terminal-pane-manager-options-persist.test.ts delete mode 100644 src/renderer/src/components/terminal-pane/terminal-pty-paste-writer.test.ts delete mode 100644 src/renderer/src/components/terminal-pane/use-visible-terminal-tab-claim.test.ts delete mode 100644 src/renderer/src/hooks/ipc-events/wsl-account-notice-ipc-bridge.test.ts delete mode 100644 src/renderer/src/hooks/usePrefersReducedMotion.test.ts delete mode 100644 src/renderer/src/lib/pane-manager/pane-layout-change-notify.test.ts delete mode 100644 src/renderer/src/lib/plugin-command-execution.test.ts delete mode 100644 src/renderer/src/lib/terminal-shortcut-capture-notification.test.tsx delete mode 100644 src/renderer/src/store/slices/worktrees/create/runtime-provisioned-root-adoption.test.ts diff --git a/config/scripts/ci-shard-timings.json b/config/scripts/ci-shard-timings.json index f4a26b957da..49ad2a67738 100644 --- a/config/scripts/ci-shard-timings.json +++ b/config/scripts/ci-shard-timings.json @@ -7305,7 +7305,6 @@ "src/renderer/src/components/cmd-j/task-search-activation.test.ts": 1297, "src/renderer/src/components/cmd-j/task-search-requests.test.ts": 1523, "src/renderer/src/components/cmd-j/worktree-checks-review-index.test.ts": 154, - "src/renderer/src/components/cmd-j/worktree-palette-cache-inputs.test.ts": 26, "src/renderer/src/components/codex-restart-chip.test.tsx": 1663, "src/renderer/src/components/comment-code-context-state.test.ts": 59, "src/renderer/src/components/comment-reply-target-state.test.ts": 37, @@ -8498,7 +8497,6 @@ "src/renderer/src/components/right-sidebar/file-explorer-read-error.test.ts": 109, "src/renderer/src/components/right-sidebar/file-explorer-refresh-concurrency.test.ts": 30, "src/renderer/src/components/right-sidebar/file-explorer-replace-selection-order-budget.test.tsx": 379, - "src/renderer/src/components/right-sidebar/file-explorer-reset.test.ts": 38, "src/renderer/src/components/right-sidebar/file-explorer-row-context-menu.test.tsx": 260, "src/renderer/src/components/right-sidebar/file-explorer-row-projection.test.ts": 51, "src/renderer/src/components/right-sidebar/file-explorer-selection.test.ts": 45, @@ -9996,7 +9994,6 @@ "src/renderer/src/components/terminal-pane/terminal-pane-layout-owner-gestures.test.ts": 43, "src/renderer/src/components/terminal-pane/terminal-pane-layout-restore.test.ts": 277, "src/renderer/src/components/terminal-pane/terminal-pane-local-windows-conpty.test.ts": 1431, - "src/renderer/src/components/terminal-pane/terminal-pane-manager-options-persist.test.ts": 2245, "src/renderer/src/components/terminal-pane/terminal-pane-mount-bootstrap.test.ts": 1256, "src/renderer/src/components/terminal-pane/terminal-pane-mount-events-layout-owner.test.ts": 743, "src/renderer/src/components/terminal-pane/terminal-pane-paste-execution.test.ts": 1123, @@ -10041,7 +10038,6 @@ "src/renderer/src/components/terminal-pane/terminal-process-exit-restart.test.ts": 42, "src/renderer/src/components/terminal-pane/terminal-programmatic-text-paste.test.ts": 272, "src/renderer/src/components/terminal-pane/terminal-pty-ack-gate.test.ts": 159, - "src/renderer/src/components/terminal-pane/terminal-pty-paste-writer.test.ts": 31, "src/renderer/src/components/terminal-pane/terminal-quick-command-dispatch.test.ts": 59, "src/renderer/src/components/terminal-pane/terminal-remote-runtime-recovery-ui-state.test.ts": 22, "src/renderer/src/components/terminal-pane/terminal-render-desync-evidence-persistence.test.ts": 52, @@ -10107,7 +10103,6 @@ "src/renderer/src/components/terminal-pane/use-terminal-scroll-visibility-memory.test.ts": 56, "src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.test.ts": 461, "src/renderer/src/components/terminal-pane/use-terminal-window-wake-recovery.test.ts": 333, - "src/renderer/src/components/terminal-pane/use-visible-terminal-tab-claim.test.ts": 64, "src/renderer/src/components/terminal-pane/use-wsl-host-unavailable-reason.test.ts": 1271, "src/renderer/src/components/terminal-pane/useSessionRestoredBannerDismiss.test.tsx": 135, "src/renderer/src/components/terminal-pane/useTerminalFontZoom.test.ts": 197, @@ -10314,7 +10309,6 @@ "src/renderer/src/hooks/ipc-events/updater-status-ipc-bridge.test.ts": 50, "src/renderer/src/hooks/ipc-events/worktree-event-lineage-refresh.test.ts": 1702, "src/renderer/src/hooks/ipc-events/worktree-event-runtime-activation.test.ts": 1375, - "src/renderer/src/hooks/ipc-events/wsl-account-notice-ipc-bridge.test.ts": 174, "src/renderer/src/hooks/ipc-events/wsl-host-ipc-bridge.test.ts": 1381, "src/renderer/src/hooks/ipc-tab-switch-group-order-hydration.test.ts": 520, "src/renderer/src/hooks/ipc-tab-switch-owner-selection.test.ts": 407, @@ -10405,7 +10399,6 @@ "src/renderer/src/hooks/useMacosTccPromptNotice.test.tsx": 1548, "src/renderer/src/hooks/useMetadataListRequest.test.tsx": 145, "src/renderer/src/hooks/useModalReturnFocus.test.tsx": 1744, - "src/renderer/src/hooks/usePrefersReducedMotion.test.ts": 45, "src/renderer/src/hooks/usePrimarySelectionPaste.terminal-native-paste.test.tsx": 216, "src/renderer/src/hooks/usePrimarySelectionPaste.test.tsx": 303, "src/renderer/src/hooks/useReadOnScreenAttention.away.test.ts": 1786, @@ -10792,7 +10785,6 @@ "src/renderer/src/lib/pane-manager/pane-inline-image-recovery.test.ts": 71, "src/renderer/src/lib/pane-manager/pane-inline-images.test.ts": 61, "src/renderer/src/lib/pane-manager/pane-key-resolution.test.ts": 40, - "src/renderer/src/lib/pane-manager/pane-layout-change-notify.test.ts": 176, "src/renderer/src/lib/pane-manager/pane-layout-geometry-apply.test.ts": 1091, "src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts": 389, "src/renderer/src/lib/pane-manager/pane-manager-registry.test.ts": 53, @@ -10875,7 +10867,6 @@ "src/renderer/src/lib/pending-worktree-creation.test.ts": 162, "src/renderer/src/lib/pi-live-session-no-duplicate-tab.test.ts": 1267, "src/renderer/src/lib/pi-session-resume-wake.test.ts": 1666, - "src/renderer/src/lib/plugin-command-execution.test.ts": 129, "src/renderer/src/lib/plugin-command-keybindings.test.ts": 184, "src/renderer/src/lib/pr-bot-author-overrides.test.ts": 396, "src/renderer/src/lib/pr-comment-action-state.test.ts": 47, @@ -11011,7 +11002,6 @@ "src/renderer/src/lib/terminal-quick-command-score-budget.test.ts": 33, "src/renderer/src/lib/terminal-quick-command-search.test.ts": 55, "src/renderer/src/lib/terminal-reveal-identity.test.ts": 36, - "src/renderer/src/lib/terminal-shortcut-capture-notification.test.tsx": 1406, "src/renderer/src/lib/terminal-tab-for-pty-id.test.ts": 54, "src/renderer/src/lib/terminal-tab-owner-activation.test.ts": 29, "src/renderer/src/lib/terminal-theme.test.ts": 69, @@ -11970,7 +11960,6 @@ "src/renderer/src/store/slices/worktrees-terminal-reference-source-race.test.ts": 748, "src/renderer/src/store/slices/worktrees-unread-state.test.ts": 1553, "src/renderer/src/store/slices/worktrees-workspace-selection-state.test.ts": 843, - "src/renderer/src/store/slices/worktrees/create/runtime-provisioned-root-adoption.test.ts": 42, "src/renderer/src/store/slices/worktrees/create/worktree-create-payload-creation-id.test.ts": 32, "src/renderer/src/store/slices/worktrees/host-scoped-row-merges.test.ts": 1447, "src/renderer/src/store/slices/worktrees/listing/detected-worktree-meta.test.ts": 125, diff --git a/src/main/agent-hooks/wsl-hook-relay-stop-settle.test.ts b/src/main/agent-hooks/wsl-hook-relay-stop-settle.test.ts index 8b8bff0d918..6da611e33ec 100644 --- a/src/main/agent-hooks/wsl-hook-relay-stop-settle.test.ts +++ b/src/main/agent-hooks/wsl-hook-relay-stop-settle.test.ts @@ -8,7 +8,7 @@ const wslMocks = vi.hoisted(() => ({ vi.mock('../wsl', () => wslMocks) import { WslRelayRecovery } from './wsl-hook-relay-recovery' -import { markWslRelayFailed } from './wsl-hook-relay-state-machine' +const { markWslRelayFailed } = await import('./wsl-hook-relay-state-machine') import { _resetWslBackgroundDistroGateForTests, isWslDistroRunning, diff --git a/src/renderer/src/components/cmd-j/worktree-palette-cache-inputs.test.ts b/src/renderer/src/components/cmd-j/worktree-palette-cache-inputs.test.ts deleted file mode 100644 index 2e9254e86bf..00000000000 --- a/src/renderer/src/components/cmd-j/worktree-palette-cache-inputs.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { AppState } from '@/store/types' -import { - EMPTY_WORKTREE_PALETTE_CACHE_INPUTS, - selectWorktreePaletteCacheInputs -} from './worktree-palette-cache-inputs' - -describe('selectWorktreePaletteCacheInputs', () => { - it('stays referentially stable across review cache writes while the palette is closed', () => { - const emptyState: Pick = { - prCache: {}, - issueCache: {}, - hostedReviewCache: {} - } - const filledState: Pick = { - prCache: { pr: { data: null, fetchedAt: 1 } }, - issueCache: { issue: { data: null, fetchedAt: 1 } }, - hostedReviewCache: { review: { data: null, fetchedAt: 1 } } - } - - const before = selectWorktreePaletteCacheInputs(emptyState, false) - const after = selectWorktreePaletteCacheInputs(filledState, false) - - expect(before).toBe(EMPTY_WORKTREE_PALETTE_CACHE_INPUTS) - expect(after).toBe(before) - }) - - it('returns live cache identities while the palette is visible', () => { - const state = { - prCache: {}, - issueCache: {}, - hostedReviewCache: {} - } as Pick - - const selected = selectWorktreePaletteCacheInputs(state, true) - - expect(selected).toEqual(state) - expect(selected.prCache).toBe(state.prCache) - expect(selected.issueCache).toBe(state.issueCache) - expect(selected.hostedReviewCache).toBe(state.hostedReviewCache) - }) -}) diff --git a/src/renderer/src/components/editor/editor-file-save-attempt.test.ts b/src/renderer/src/components/editor/editor-file-save-attempt.test.ts index f194c33d9e4..1930f8394db 100644 --- a/src/renderer/src/components/editor/editor-file-save-attempt.test.ts +++ b/src/renderer/src/components/editor/editor-file-save-attempt.test.ts @@ -20,14 +20,6 @@ describe('attemptEditorFileSave', () => { vi.restoreAllMocks() }) - it('reports success only after the save request resolves', async () => { - requestEditorFileSave.mockResolvedValue(undefined) - - await expect(attemptEditorFileSave({ fileId: 'file-1' })).resolves.toBe(true) - - expect(toastError).not.toHaveBeenCalled() - }) - it('surfaces a failed save and reports failure to dependent actions (STA-2027)', async () => { const consoleError = vi.spyOn(console, 'error').mockImplementation(() => {}) const cause = new Error('disk full') diff --git a/src/renderer/src/components/right-sidebar/file-explorer-reset.test.ts b/src/renderer/src/components/right-sidebar/file-explorer-reset.test.ts deleted file mode 100644 index d512879a0cd..00000000000 --- a/src/renderer/src/components/right-sidebar/file-explorer-reset.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - getVisibleFileExplorerWorktreePath, - shouldResetFileExplorerForVisibleWorktree -} from './file-explorer-reset' - -describe('getVisibleFileExplorerWorktreePath', () => { - it('exposes the worktree path only while the Files view is visible', () => { - expect( - getVisibleFileExplorerWorktreePath({ - explorerView: 'files', - rightSidebarOpen: true, - worktreePath: '/repo' - }) - ).toBe('/repo') - expect( - getVisibleFileExplorerWorktreePath({ - explorerView: 'search', - rightSidebarOpen: true, - worktreePath: '/repo' - }) - ).toBeNull() - expect( - getVisibleFileExplorerWorktreePath({ - explorerView: 'files', - rightSidebarOpen: false, - worktreePath: '/repo' - }) - ).toBeNull() - }) -}) - -describe('shouldResetFileExplorerForVisibleWorktree', () => { - it('preserves explorer state across hide and reopen of the same worktree', () => { - let lastResetWorktreePath: string | null = null - const shouldReset = (visibleWorktreePath: string | null): boolean => { - if (shouldResetFileExplorerForVisibleWorktree(lastResetWorktreePath, visibleWorktreePath)) { - lastResetWorktreePath = visibleWorktreePath - return true - } - return false - } - - expect(shouldReset(null)).toBe(false) - expect(shouldReset('/repo')).toBe(true) - expect(shouldReset(null)).toBe(false) - expect(shouldReset('/repo')).toBe(false) - }) - - it('resets when the visible worktree path changes', () => { - expect(shouldResetFileExplorerForVisibleWorktree('/repo', '/repo-next')).toBe(true) - }) -}) diff --git a/src/renderer/src/components/terminal-pane/terminal-pane-manager-options-persist.test.ts b/src/renderer/src/components/terminal-pane/terminal-pane-manager-options-persist.test.ts deleted file mode 100644 index 2f21accbd68..00000000000 --- a/src/renderer/src/components/terminal-pane/terminal-pane-manager-options-persist.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import { createTerminalPaneManagerOptions } from './terminal-pane-manager-options' -import type { TerminalPaneManagerOptionsContext } from './terminal-pane-mount-context' - -vi.mock('@/runtime/sync-runtime-graph', () => ({ scheduleRuntimeGraphSync: vi.fn() })) - -function createOptions(shouldPersistLayout = true) { - const persistLayoutSnapshot = vi.fn() - const context = { - deps: { - persistLayoutSnapshot, - syncExpandedLayout: vi.fn(), - tabId: 'tab', - worktreeId: 'wt', - isVisibleRef: { current: true }, - settingsRef: { current: null } - }, - ptyDeps: {}, - syncCanExpandState: vi.fn(), - syncPaneCount: vi.fn(), - syncPaneLayoutRevision: vi.fn(), - queueResizeAll: vi.fn(), - shouldPersistLayout: () => shouldPersistLayout - } - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: building options and running onLayoutChanged read only these fields. - const optionsContext = context as unknown as TerminalPaneManagerOptionsContext - const options = createTerminalPaneManagerOptions(optionsContext) - return { options, persistLayoutSnapshot } -} - -describe('terminal pane manager layout persist wiring', () => { - it('persists a layout change', () => { - const { options, persistLayoutSnapshot } = createOptions() - options.onLayoutChanged?.() - expect(persistLayoutSnapshot).toHaveBeenCalledOnce() - }) - - it('keeps the persist gate', () => { - const { options, persistLayoutSnapshot } = createOptions(false) - options.onLayoutChanged?.() - expect(persistLayoutSnapshot).not.toHaveBeenCalled() - }) -}) diff --git a/src/renderer/src/components/terminal-pane/terminal-pty-paste-writer.test.ts b/src/renderer/src/components/terminal-pane/terminal-pty-paste-writer.test.ts deleted file mode 100644 index 7cb08104c36..00000000000 --- a/src/renderer/src/components/terminal-pane/terminal-pty-paste-writer.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' - -import { writeTerminalPastePtyInput } from './terminal-pty-paste-writer' - -describe('terminal PTY paste writer', () => { - it('prefers acknowledged PTY writes when available', async () => { - const sendInput = vi.fn().mockReturnValue(true) - const sendInputAccepted = vi.fn().mockResolvedValue(true) - - await expect( - writeTerminalPastePtyInput({ sendInput, sendInputAccepted }, 'payload', 'driving') - ).resolves.toBe(true) - - expect(sendInputAccepted).toHaveBeenCalledWith('payload', 'driving') - expect(sendInput).not.toHaveBeenCalled() - }) - - it('lets the caller withdraw an acknowledged write it stopped waiting for', async () => { - const sendInputAccepted = vi.fn().mockResolvedValue(true) - const controller = new AbortController() - - await writeTerminalPastePtyInput( - { sendInput: vi.fn(), sendInputAccepted }, - 'payload', - 'driving', - controller.signal - ) - - expect(sendInputAccepted).toHaveBeenCalledWith('payload', 'driving', { - signal: controller.signal - }) - }) - - it('falls back to queued PTY writes when acknowledged writes are unavailable', () => { - const sendInput = vi.fn().mockReturnValue(true) - - expect(writeTerminalPastePtyInput({ sendInput }, 'payload', 'driving')).toBe(true) - expect(sendInput).toHaveBeenCalledWith('payload', 'driving') - }) - - it('rejects writes without a transport', () => { - expect(writeTerminalPastePtyInput(undefined, 'payload', 'driving')).toBe(false) - }) -}) diff --git a/src/renderer/src/components/terminal-pane/terminal-url-link-hit-testing.test.ts b/src/renderer/src/components/terminal-pane/terminal-url-link-hit-testing.test.ts index 75fe1b24801..a4ac2556658 100644 --- a/src/renderer/src/components/terminal-pane/terminal-url-link-hit-testing.test.ts +++ b/src/renderer/src/components/terminal-pane/terminal-url-link-hit-testing.test.ts @@ -1,11 +1,7 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' +import { describe, expect, it } from 'vitest' import { extractTerminalHttpLinks } from '../../../../shared/terminal-http-url-extraction' import { TERMINAL_HTTP_URL_MAX_LENGTH } from '../../../../shared/terminal-http-link-limits' -afterEach(() => { - vi.restoreAllMocks() -}) - describe('extractTerminalHttpLinks', () => { it('extracts regular http links and trims terminal trailing punctuation', () => { const line = 'open https://example.com/path?x=1.' @@ -29,19 +25,4 @@ describe('extractTerminalHttpLinks', () => { expect(extractTerminalHttpLinks(overlongUrl)).toEqual([]) }) - - it('scans large pasted terminal lines without regex match iteration', () => { - const matchAllSpy = vi.spyOn(String.prototype, 'matchAll') - const pastedPrefix = 'pasted terminal noise '.repeat(10_000) - const line = `${pastedPrefix}https://example.com/docs?q=orca.` - - expect(extractTerminalHttpLinks(line)).toEqual([ - { - url: 'https://example.com/docs?q=orca', - startIndex: pastedPrefix.length, - endIndex: line.length - 1 - } - ]) - expect(matchAllSpy).not.toHaveBeenCalled() - }) }) diff --git a/src/renderer/src/components/terminal-pane/use-visible-terminal-tab-claim.test.ts b/src/renderer/src/components/terminal-pane/use-visible-terminal-tab-claim.test.ts deleted file mode 100644 index 252c4428874..00000000000 --- a/src/renderer/src/components/terminal-pane/use-visible-terminal-tab-claim.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -import type * as ReactModule from 'react' -import { afterEach, describe, expect, it, vi } from 'vitest' -import { - getForegroundTerminalTabIds, - resetForegroundTerminalTabIdsForTests -} from '@/lib/foreground-terminal-tabs' -import { useVisibleTerminalTabClaim } from './use-visible-terminal-tab-claim' - -const reactEffects = vi.hoisted(() => ({ - layoutEffects: [] as (() => void | (() => void))[], - passiveEffects: [] as (() => void | (() => void))[] -})) - -vi.mock('react', async (importOriginal) => { - const actual = await importOriginal() - return { - ...actual, - useEffect: (effect: () => void | (() => void)) => { - reactEffects.passiveEffects.push(effect) - }, - useLayoutEffect: (effect: () => void | (() => void)) => { - reactEffects.layoutEffects.push(effect) - } - } -}) - -afterEach(() => { - resetForegroundTerminalTabIdsForTests() - reactEffects.layoutEffects = [] - reactEffects.passiveEffects = [] -}) - -describe('useVisibleTerminalTabClaim', () => { - it('registers visible panes through a layout effect', () => { - useVisibleTerminalTabClaim({ isVisible: true, tabId: 'tab-visible' }) - - expect(reactEffects.passiveEffects).toHaveLength(0) - expect(reactEffects.layoutEffects).toHaveLength(1) - - const cleanup = reactEffects.layoutEffects[0]() - expect(getForegroundTerminalTabIds()).toEqual(['tab-visible']) - - cleanup?.() - expect(getForegroundTerminalTabIds()).toEqual([]) - }) - - it('does not claim hidden panes', () => { - useVisibleTerminalTabClaim({ isVisible: false, tabId: 'tab-hidden' }) - - reactEffects.layoutEffects[0]() - - expect(getForegroundTerminalTabIds()).toEqual([]) - }) -}) diff --git a/src/renderer/src/components/terminal-search-safe-find.test.ts b/src/renderer/src/components/terminal-search-safe-find.test.ts index cd32e54ea14..c6a5171b9de 100644 --- a/src/renderer/src/components/terminal-search-safe-find.test.ts +++ b/src/renderer/src/components/terminal-search-safe-find.test.ts @@ -17,13 +17,6 @@ describe('safeFind (TerminalSearch decoration crash guard)', () => { expect(find).toHaveBeenCalledWith('query', undefined) }) - it('returns the addon result and forwards options on the normal path', () => { - const find = vi.fn(() => true) - const options = { caseSensitive: true } - expect(safeFind(find, 'q', options)).toBe(true) - expect(find).toHaveBeenCalledWith('q', options) - }) - it('re-throws unrelated errors so genuine bugs are not hidden', () => { const find = vi.fn(() => { throw new TypeError('something genuinely broken') diff --git a/src/renderer/src/hooks/ipc-events/wsl-account-notice-ipc-bridge.test.ts b/src/renderer/src/hooks/ipc-events/wsl-account-notice-ipc-bridge.test.ts deleted file mode 100644 index 67e45eb78a1..00000000000 --- a/src/renderer/src/hooks/ipc-events/wsl-account-notice-ipc-bridge.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' - -const { info } = vi.hoisted(() => ({ info: vi.fn() })) -vi.mock('sonner', () => ({ toast: { info } })) - -import { - registerWslAccountNoticeIpcBridge, - showWslAccountNotAppliedNotice -} from './wsl-account-notice-ipc-bridge' - -describe('WSL account-not-applied notice', () => { - afterEach(() => { - info.mockReset() - vi.unstubAllGlobals() - }) - - it('shows a non-blocking info toast keyed by distro', () => { - showWslAccountNotAppliedNotice({ distro: 'Ubuntu' }) - expect(info).toHaveBeenCalledWith( - 'Account selection not applied in Ubuntu', - expect.objectContaining({ id: 'wsl-account-not-applied:ubuntu' }) - ) - expect(info.mock.calls[0][1]).not.toHaveProperty('duration') - }) - - it('subscribes to the desktop event and skips a client without one', () => { - const unsubscribe = vi.fn() - let listener: ((event: { distro: string }) => void) | undefined - vi.stubGlobal('window', { - api: { - runtimeEnvironments: { - onWslAccountNotApplied: (callback: (event: { distro: string }) => void) => { - listener = callback - return unsubscribe - } - } - } - }) - const unsubs: (() => void)[] = [] - registerWslAccountNoticeIpcBridge(unsubs) - listener?.({ distro: 'Debian' }) - expect(info).toHaveBeenCalledTimes(1) - expect(unsubs).toEqual([unsubscribe]) - - vi.stubGlobal('window', { api: { runtimeEnvironments: {} } }) - const none: (() => void)[] = [] - registerWslAccountNoticeIpcBridge(none) - expect(none).toEqual([]) - }) -}) diff --git a/src/renderer/src/hooks/usePrefersReducedMotion.test.ts b/src/renderer/src/hooks/usePrefersReducedMotion.test.ts deleted file mode 100644 index 71992728945..00000000000 --- a/src/renderer/src/hooks/usePrefersReducedMotion.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' -import { motionSafeScrollBehavior } from './usePrefersReducedMotion' - -function stubReducedMotion(reduce: boolean): ReturnType { - const matchMedia = vi.fn((query: string) => ({ - matches: reduce && query === '(prefers-reduced-motion: reduce)' - })) - vi.stubGlobal('window', { matchMedia }) - return matchMedia -} - -afterEach(() => { - vi.unstubAllGlobals() -}) - -describe('motionSafeScrollBehavior', () => { - it('jumps instead of smooth-scrolling when reduced motion is on', () => { - const matchMedia = stubReducedMotion(true) - - expect(motionSafeScrollBehavior()).toBe('auto') - expect(motionSafeScrollBehavior('smooth')).toBe('auto') - expect(motionSafeScrollBehavior('instant')).toBe('instant') - expect(motionSafeScrollBehavior('auto')).toBe('auto') - expect(matchMedia).toHaveBeenCalledWith('(prefers-reduced-motion: reduce)') - }) - - it('keeps the requested behavior when reduced motion is off', () => { - stubReducedMotion(false) - - expect(motionSafeScrollBehavior()).toBe('smooth') - expect(motionSafeScrollBehavior('smooth')).toBe('smooth') - expect(motionSafeScrollBehavior('instant')).toBe('instant') - }) - - it('keeps the requested behavior without matchMedia', () => { - expect(typeof window).toBe('undefined') - expect(motionSafeScrollBehavior()).toBe('smooth') - - vi.stubGlobal('window', {}) - expect(motionSafeScrollBehavior('smooth')).toBe('smooth') - expect(motionSafeScrollBehavior('auto')).toBe('auto') - }) -}) diff --git a/src/renderer/src/lib/pane-manager/pane-layout-change-notify.test.ts b/src/renderer/src/lib/pane-manager/pane-layout-change-notify.test.ts deleted file mode 100644 index 5e75c63cc1d..00000000000 --- a/src/renderer/src/lib/pane-manager/pane-layout-change-notify.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -// @vitest-environment happy-dom -import { describe, expect, it, vi } from 'vitest' -import { createDivider } from './pane-divider' -import { equalizeManagedPaneSizes } from './pane-manager-layout-sweeps' -import type { ManagedPaneInternal } from './pane-manager-types' - -function makePane(flex: string): HTMLElement { - const pane = document.createElement('div') - pane.className = 'pane' - pane.style.flex = flex - return pane -} - -describe('pane layout change notification', () => { - it('reports a divider double-click reset', () => { - const onLayoutChanged = vi.fn() - const split = document.createElement('div') - const divider = createDivider(true, {}, { refitPanesUnder: vi.fn(), onLayoutChanged }) - split.append(makePane('3 1 0%'), divider, makePane('1 1 0%')) - - divider.dispatchEvent(new MouseEvent('dblclick')) - - expect(onLayoutChanged).toHaveBeenCalledOnce() - }) - - it('reports an equalize command only when it changes sizes', () => { - const onLayoutChanged = vi.fn() - const root = document.createElement('div') - const split = document.createElement('div') - split.className = 'pane-split' - split.append(makePane('3 1 0%'), createDivider(true, {}, { refitPanesUnder: vi.fn() })) - split.append(makePane('1 1 0%')) - root.append(split) - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: equalize reads only the pane count. - const panes = new Map([ - [1, {}], - [2, {}] - ]) as unknown as Map - - equalizeManagedPaneSizes(panes, root, onLayoutChanged) - equalizeManagedPaneSizes(panes, root, onLayoutChanged) - - expect(onLayoutChanged).toHaveBeenCalledOnce() - }) -}) diff --git a/src/renderer/src/lib/plugin-command-execution.test.ts b/src/renderer/src/lib/plugin-command-execution.test.ts deleted file mode 100644 index b8551c07845..00000000000 --- a/src/renderer/src/lib/plugin-command-execution.test.ts +++ /dev/null @@ -1,54 +0,0 @@ -// @vitest-environment happy-dom - -import { afterEach, describe, expect, it, vi } from 'vitest' -import type { ActivePluginCommand } from '@/store/plugin-panels' -import { registerAppCommandDispatcher } from './app-command-dispatch' -import { executePluginCommand } from './plugin-command-execution' - -let unregister: (() => void) | null = null - -afterEach(() => { - unregister?.() - unregister = null -}) - -function command(handler: ActivePluginCommand['handler']): ActivePluginCommand { - return { - pluginKey: 'orca-samples.tasks', - pluginName: 'Tasks', - id: 'open', - title: 'Open Tasks', - context: 'global', - handler, - keybindings: [] - } -} - -describe('plugin command execution', () => { - it('dispatches aliases without invoking a plugin worker', async () => { - const dispatcher = vi.fn(() => true) - const invokeCommand = vi.fn() - unregister = registerAppCommandDispatcher(dispatcher) - Object.assign(window, { api: { plugins: { invokeCommand } } }) - - await executePluginCommand( - command({ type: 'built-in', action: 'view.tasks' }), - 'plugin-palette' - ) - - expect(dispatcher).toHaveBeenCalledWith('view.tasks', 'plugin-palette') - expect(invokeCommand).not.toHaveBeenCalled() - }) - - it('routes worker commands through the authenticated preload binding', async () => { - const invokeCommand = vi.fn().mockResolvedValue({ ok: true }) - Object.assign(window, { api: { plugins: { invokeCommand } } }) - - await executePluginCommand(command({ type: 'worker' }), 'plugin-keybinding') - - expect(invokeCommand).toHaveBeenCalledWith({ - pluginKey: 'orca-samples.tasks', - commandId: 'open' - }) - }) -}) diff --git a/src/renderer/src/lib/terminal-shortcut-capture-notification.test.tsx b/src/renderer/src/lib/terminal-shortcut-capture-notification.test.tsx deleted file mode 100644 index ca01a3dce2c..00000000000 --- a/src/renderer/src/lib/terminal-shortcut-capture-notification.test.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { toast } from 'sonner' -import { showTerminalShortcutCaptureNotification } from './terminal-shortcut-capture-notification' - -const { toastMessage } = vi.hoisted(() => ({ - toastMessage: vi.fn() -})) - -vi.mock('sonner', () => ({ - toast: { - message: toastMessage - } -})) - -function createLocalStorage(): Storage { - const values = new Map() - - return { - get length() { - return values.size - }, - clear: () => values.clear(), - getItem: (key: string) => values.get(key) ?? null, - key: (index: number) => Array.from(values.keys())[index] ?? null, - removeItem: (key: string) => { - values.delete(key) - }, - setItem: (key: string, value: string) => { - values.set(key, value) - } - } -} - -describe('showTerminalShortcutCaptureNotification', () => { - beforeEach(() => { - vi.stubGlobal('localStorage', createLocalStorage()) - }) - - afterEach(() => { - vi.unstubAllGlobals() - vi.clearAllMocks() - }) - - it('keeps the shortcut capture warning visible long enough to act on', () => { - showTerminalShortcutCaptureNotification({ - actionId: 'tab.close', - platform: 'darwin' - }) - - expect(toast.message).toHaveBeenCalledWith( - 'Terminal shortcut handled', - expect.objectContaining({ - className: expect.stringContaining('!py-2'), - classNames: expect.objectContaining({ - title: expect.stringContaining('truncate'), - description: expect.stringContaining('truncate') - }), - duration: 20_000, - dismissible: true, - action: expect.objectContaining({ label: 'Open Shortcuts' }) - }) - ) - }) -}) diff --git a/src/renderer/src/runtime/remote-restore-spawn-intent.test.ts b/src/renderer/src/runtime/remote-restore-spawn-intent.test.ts index 2c685a72fcc..a87efef371d 100644 --- a/src/renderer/src/runtime/remote-restore-spawn-intent.test.ts +++ b/src/renderer/src/runtime/remote-restore-spawn-intent.test.ts @@ -30,9 +30,4 @@ describe('remoteRestoreSpawnIntentParams', () => { runtimeEnvironmentSupportsCapability.mockRejectedValueOnce(new Error('offline')) await expect(remoteRestoreSpawnIntentParams('env-1', 'automatic-restore')).resolves.toEqual({}) }) - - it('does not probe when the connect is not a restore', async () => { - await expect(remoteRestoreSpawnIntentParams('env-1', undefined)).resolves.toEqual({}) - expect(runtimeEnvironmentSupportsCapability).not.toHaveBeenCalled() - }) }) diff --git a/src/renderer/src/store/slices/worktrees/create/runtime-provisioned-root-adoption.test.ts b/src/renderer/src/store/slices/worktrees/create/runtime-provisioned-root-adoption.test.ts deleted file mode 100644 index 9fc1fc7d03a..00000000000 --- a/src/renderer/src/store/slices/worktrees/create/runtime-provisioned-root-adoption.test.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest' - -vi.mock('../../../../runtime/runtime-rpc-client', () => ({ callRuntimeRpc: vi.fn() })) - -import { callRuntimeRpc } from '../../../../runtime/runtime-rpc-client' -import { adoptRuntimeProvisionedRoot } from './runtime-provisioned-root-adoption' - -describe('adoptRuntimeProvisionedRoot', () => { - beforeEach(() => { - vi.clearAllMocks() - vi.stubGlobal('window', { - api: { ephemeralVm: { attachWorkspace: vi.fn(async () => ({})) } } - }) - }) - - it("adopts the root on the VM's server, then records the workspace on the VM runtime", async () => { - vi.mocked(callRuntimeRpc).mockResolvedValue({ - worktree: { id: 'repo-vm::/workspace/repo', repoId: 'repo-vm' } - }) - const result = await adoptRuntimeProvisionedRoot( - { kind: 'environment', environmentId: 'env-vm' }, - { repoId: 'repo-vm', name: 'fix-login', baseBranch: 'main' }, - { name: 'fix-login' }, - { - runtimeId: 'runtime-1', - executionHostId: 'runtime:env-vm', - expectedPath: '/workspace/repo', - expectedRefHead: 'abc123' - } - ) - expect(callRuntimeRpc).toHaveBeenCalledWith( - { kind: 'environment', environmentId: 'env-vm' }, - 'worktree.adoptProvisionedRoot', - expect.objectContaining({ - repo: 'repo-vm', - name: 'fix-login', - baseBranch: 'main', - expectedPath: '/workspace/repo', - expectedRefHead: 'abc123' - }), - expect.anything() - ) - expect(window.api.ephemeralVm.attachWorkspace).toHaveBeenCalledWith({ - runtimeId: 'runtime-1', - workspaceId: 'repo-vm::/workspace/repo' - }) - expect(result.worktree.id).toBe('repo-vm::/workspace/repo') - }) -}) diff --git a/src/shared/remote-runtime/remote-runtime-pty-id.test.ts b/src/shared/remote-runtime/remote-runtime-pty-id.test.ts index 08aaa40e9b4..ac03a176041 100644 --- a/src/shared/remote-runtime/remote-runtime-pty-id.test.ts +++ b/src/shared/remote-runtime/remote-runtime-pty-id.test.ts @@ -1,25 +1,8 @@ import { describe, expect, it } from 'vitest' -import { - isRemoteRuntimePtyId, - parseRemoteRuntimePtyId, - toRemoteRuntimePtyId -} from './remote-runtime-pty-id' +import { isRemoteRuntimePtyId, parseRemoteRuntimePtyId } from './remote-runtime-pty-id' import { getPtyExecutionHost } from '../terminal-execution-host' describe('isRemoteRuntimePtyId', () => { - it('recognizes minted paired-runtime ids, with and without an owner', () => { - expect(isRemoteRuntimePtyId(toRemoteRuntimePtyId('h1', 'env 1'))).toBe(true) - expect(isRemoteRuntimePtyId(toRemoteRuntimePtyId('h1'))).toBe(true) - }) - - it('rejects local, SSH and missing ids', () => { - expect(isRemoteRuntimePtyId('pty-1')).toBe(false) - expect(isRemoteRuntimePtyId('ssh:conn@@pty-1')).toBe(false) - expect(isRemoteRuntimePtyId('')).toBe(false) - expect(isRemoteRuntimePtyId(null)).toBe(false) - expect(isRemoteRuntimePtyId(undefined)).toBe(false) - }) - // Pins the merge of the prefix-only and parse-based copies: an unparseable `remote:` id still // runs off this host, matching getPtyExecutionHost's 'foreign' verdict. it('treats an unparseable remote id as remote, never local', () => {