From db41b72236aa248e8b81f3ab3a44ae7f1fd2104c Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Sun, 15 Nov 2026 14:53:15 -0800 Subject: [PATCH] test: remove 32 low-value suites (#42831) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- .../scripts/ci/sharding/ci-shard-timings.json | 21 ----- .../browser-touch-geometry.test.ts | 44 ---------- .../feedback/native-screen-recovery.test.tsx | 39 --------- mobile/src/layout/fold-division.test.ts | 44 ---------- .../creation/workspace-ssh-gate.test.ts | 37 -------- .../popup-identity-electron-probe.test.ts | 53 ------------ .../minidumps/minidump-file-source.test.ts | 44 ---------- src/main/emulator/serve-sim-execution.test.ts | 39 --------- .../removal/worktree-delete-limit.test.ts | 52 ------------ .../removal/worktree-delete-limit.ts | 4 - ...rminal-startup-color-query-replies.test.ts | 37 -------- .../local-build-feed-server.test.ts | 37 -------- .../daemon/orcad-daemon-supervision.test.ts | 37 -------- ...erminal-leaf-move-concurrent-close.test.ts | 56 ------------ .../worktree-create-exact-name.test.ts | 37 -------- .../sleep-record-pane-claim.test.ts | 44 ---------- ...desktop-server-writes-layout-owner.test.ts | 43 ---------- ...h-host-server-on-connect-telemetry.test.ts | 45 ---------- .../ssh-target-route-resolution.test.ts | 52 ------------ .../agent-default-env-draft.test.ts | 55 ------------ .../claude-model-switch-confirmation.test.ts | 29 ------- .../serialized-screen-background-rows.test.ts | 45 ---------- ...accounts-pane-opencode-credentials.test.ts | 44 ---------- .../fonts/FontAutocomplete.test.tsx | 85 ------------------- .../ShortcutsPane.provenance.test.tsx | 76 ----------------- ...ShortcutsPane.recorder-click-away.test.tsx | 77 ----------------- .../use-sortable-tab-context-menu.test.ts | 34 -------- .../terminal-search-safe-find.test.ts | 26 ------ .../messaging/agent-send-title-status.test.ts | 10 --- .../clipboard/images/image-blob-png.test.ts | 29 ------- .../projects/project-roadmap-timeline.test.ts | 39 --------- .../tools/native-chat-tool-activity.spec.ts | 37 -------- .../native-chat-transcript-contracts.test.ts | 1 - .../work-items/task-source-context.test.ts | 52 ------------ .../work-items/work-item-empty-page.test.ts | 45 ---------- 35 files changed, 1449 deletions(-) delete mode 100644 mobile/src/browser/page-interaction/browser-touch-geometry.test.ts delete mode 100644 mobile/src/components/feedback/native-screen-recovery.test.tsx delete mode 100644 mobile/src/layout/fold-division.test.ts delete mode 100644 mobile/src/new-workspace/creation/workspace-ssh-gate.test.ts delete mode 100644 src/main/browser/electron-fixtures/popup-identity-electron-probe.test.ts delete mode 100644 src/main/crash-reporting/minidumps/minidump-file-source.test.ts delete mode 100644 src/main/emulator/serve-sim-execution.test.ts delete mode 100644 src/main/git/worktrees/removal/worktree-delete-limit.test.ts delete mode 100644 src/main/ipc/terminal-startup-color-query-replies.test.ts delete mode 100644 src/main/local-builds/local-build-feed-server.test.ts delete mode 100644 src/main/orcad/daemon/orcad-daemon-supervision.test.ts delete mode 100644 src/main/persistence/terminal-topology/pane-moves/terminal-leaf-move-concurrent-close.test.ts delete mode 100644 src/main/runtime/rpc/methods/workspaces/worktree-create-exact-name.test.ts delete mode 100644 src/main/runtime/session-lifecycle/projection/sleep-record-pane-claim.test.ts delete mode 100644 src/main/runtime/terminal/layout/paired-desktop-server-writes-layout-owner.test.ts delete mode 100644 src/main/ssh/host-server/ssh-host-server-on-connect-telemetry.test.ts delete mode 100644 src/main/ssh/targets/ssh-target-route-resolution.test.ts delete mode 100644 src/renderer/src/components/agent/launch-settings/agent-default-env-draft.test.ts delete mode 100644 src/renderer/src/components/native-chat/session/options/terminal/claude-model-switch-confirmation.test.ts delete mode 100644 src/renderer/src/components/native-chat/session/options/terminal/serialized-screen-background-rows.test.ts delete mode 100644 src/renderer/src/components/settings/accounts/usage/accounts-pane-opencode-credentials.test.ts delete mode 100644 src/renderer/src/components/settings/appearance/fonts/FontAutocomplete.test.tsx delete mode 100644 src/renderer/src/components/settings/shortcuts/ShortcutsPane.provenance.test.tsx delete mode 100644 src/renderer/src/components/settings/shortcuts/ShortcutsPane.recorder-click-away.test.tsx delete mode 100644 src/renderer/src/components/tab-bar/use-sortable-tab-context-menu.test.ts delete mode 100644 src/renderer/src/components/terminal-search-safe-find.test.ts delete mode 100644 src/renderer/src/lib/agent-session/messaging/agent-send-title-status.test.ts delete mode 100644 src/renderer/src/lib/clipboard/images/image-blob-png.test.ts delete mode 100644 src/shared/github/projects/project-roadmap-timeline.test.ts delete mode 100644 src/shared/native-chat/tools/native-chat-tool-activity.spec.ts delete mode 100644 src/shared/work-items/task-source-context.test.ts delete mode 100644 src/shared/work-items/work-item-empty-page.test.ts diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json index e13dc2d4b93..97161dfdec7 100644 --- a/config/scripts/ci/sharding/ci-shard-timings.json +++ b/config/scripts/ci/sharding/ci-shard-timings.json @@ -792,7 +792,6 @@ "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-identity.test.ts": 1404, "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-command-admission.test.ts": 213, "src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts": 1150, - "src/main/browser/electron-fixtures/popup-identity-electron-probe.test.ts": 144, "src/main/browser/network/tunnels/remote-browser-socks-buffering.test.ts": 384, "src/main/browser/network/tunnels/remote-browser-socks-server.test.ts": 309, "src/main/browser/cdp/snapshots/snapshot-engine.test.ts": 48, @@ -1101,7 +1100,6 @@ "src/main/crash-reporting/breadcrumbs/crash-breadcrumb-store-orphan-cleanup.test.ts": 81, "src/main/crash-reporting/reports/crash-report-store.test.ts": 438, "src/main/crash-reporting/minidumps/minidump-crash-signature.test.ts": 87, - "src/main/crash-reporting/minidumps/minidump-file-source.test.ts": 199, "src/main/crash-reporting/memory/renderer-heap-allocation-sites.test.ts": 62, "src/main/credentials/saved-credential-readability.test.ts": 56, "src/main/cursor/hook-command.live-shell.test.ts": 488, @@ -1407,7 +1405,6 @@ "src/main/git/worktrees/creation/worktree-create-preparation-real-wsl.test.ts": 382, "src/main/git/worktrees/catalog/worktree-created-description-real-git.test.ts": 1119, "src/main/git/worktrees/catalog/worktree-created-disk-witness.test.ts": 259, - "src/main/git/worktrees/removal/worktree-delete-limit.test.ts": 33, "src/main/git/worktrees/catalog/worktree-git-capabilities.test.ts": 297, "src/main/git/worktrees/catalog/worktree-graph-listing.test.ts": 302, "src/main/git/worktrees/catalog/worktree-list-paths.test.ts": 755, @@ -1681,7 +1678,6 @@ "src/main/ipc/ssh/ssh-host-user-disconnect.test.ts": 4734, "src/main/ipc/ssh/ssh-passphrase.test.ts": 135, "src/main/ipc/terminal-render-desync-evidence.test.ts": 78, - "src/main/ipc/terminal-startup-color-query-replies.test.ts": 265, "src/main/workspaces/removal/watcher-removal-gate.test.ts": 384, "src/main/ipc/workspace-cleanup/workspace-cleanup-activity.test.ts": 76, "src/main/ipc/workspace-cleanup/workspace-cleanup-document-lifetime.test.ts": 1130, @@ -1749,7 +1745,6 @@ "src/main/updater/linux-package/linux-package-install-diagnostic.test.ts": 47, "src/main/updater/linux-package/linux-package-update-recovery.test.ts": 261, "src/main/local-builds/local-build-candidate.test.ts": 154, - "src/main/local-builds/local-build-feed-server.test.ts": 73, "src/main/local-builds/local-build-switch.test.ts": 434, "src/main/workspaces/removal/local-worktree-filesystem-wsl-banner.wsl.test.ts": 84, "src/main/workspaces/removal/local-worktree-filesystem.test.ts": 4284, @@ -2088,7 +2083,6 @@ "src/main/persistence/terminal-topology/pane-admission/terminal-layout-create.test.ts": 2107, "src/main/persistence/terminal-topology/command-application/terminal-layout-pane-ops.test.ts": 1753, "src/main/persistence/terminal-topology/command-application/terminal-layout-sleep-wake.test.ts": 2198, - "src/main/persistence/terminal-topology/pane-moves/terminal-leaf-move-concurrent-close.test.ts": 1847, "src/main/persistence/terminal-topology/pane-moves/terminal-leaf-move.test.ts": 2197, "src/shared/workspace-layout/terminal-topology/terminal-owner-invariants.test.ts": 285, "src/main/persistence/loading-store/workspace-sessions/terminal-sleep-quit-resume.test.ts": 1766, @@ -2543,7 +2537,6 @@ "src/main/runtime/orchestration/workers/transcripts/worker-transcript-read.test.ts": 466, "src/main/runtime/orchestration/workers/turn-stops/worker-turn-stops.test.ts": 979, "src/main/runtime/workspaces/removal/owned-session-teardown-policy.test.ts": 9728, - "src/main/runtime/terminal/layout/paired-desktop-server-writes-layout-owner.test.ts": 4976, "src/main/runtime/session-tabs/paired-host-terminal-close.test.ts": 4284, "src/main/runtime/client/peer-desktops.integration.test.ts": 4695, "src/main/runtime/terminal/wait/prime-agent-screen-readiness-transcripts.test.ts": 7843, @@ -2884,7 +2877,6 @@ "src/main/runtime/workspaces/startup/runtime-worktree-startup-readiness.test.ts": 289, "src/main/runtime/workspaces/process-listing/runtime-worktree-structured-agent-rows-liveness.test.ts": 1412, "src/main/runtime/session-lifecycle/projection/pane-sleeping-record.test.ts": 76, - "src/main/runtime/session-lifecycle/projection/sleep-record-pane-claim.test.ts": 48, "src/main/runtime/session-tabs/session-tab-close-force.test.ts": 7089, "src/main/runtime/session-tabs/runtime-inventory-publication-authority.test.ts": 5775, "src/main/runtime/session-tabs/session-tab-prototype-dispatch.test.ts": 4888, @@ -3132,7 +3124,6 @@ "src/main/ssh/host-keys/ssh-host-key-verifier.test.ts": 97, "src/main/ssh/host-server/ssh-host-server-on-connect-held-move.test.ts": 510, "src/main/ssh/host-server/ssh-host-server-on-connect-node-download.test.ts": 455, - "src/main/ssh/host-server/ssh-host-server-on-connect-telemetry.test.ts": 440, "src/main/ssh/host-server/ssh-host-server-on-connect.test.ts": 536, "src/main/ssh/host-server/ssh-host-server-telemetry.test.ts": 194, "src/main/ssh/authentication/ssh-identity-file-read.test.ts": 111, @@ -3164,7 +3155,6 @@ "src/main/ssh/targets/ssh-target-orcad-dependents.test.ts": 305, "src/main/ssh/targets/ssh-target-orcad-preflight.test.ts": 1698, "src/main/ssh/targets/ssh-target-readoption.test.ts": 52, - "src/main/ssh/targets/ssh-target-route-resolution.test.ts": 95, "src/main/star-nag/service-direct-star.test.ts": 335, "src/main/star-nag/service-force-show-races.test.ts": 351, "src/main/star-nag/service-threshold-prompt.test.ts": 307, @@ -3714,7 +3704,6 @@ "src/renderer/src/components/native-chat/session/attention/StructuredAgentSessionAttentionBridge.test.tsx": 2855, "src/renderer/src/components/native-chat/session/status/StructuredAgentSessionStatusBridge.launch-directory.test.tsx": 3826, "src/renderer/src/components/native-chat/messages/notices/agent-session-write-notice-text.test.ts": 299, - "src/renderer/src/components/native-chat/session/options/terminal/claude-model-switch-confirmation.test.ts": 1969, "src/renderer/src/components/native-chat/paste/inline-deferred-input.test.tsx": 2562, "src/renderer/src/components/native-chat/queue/editing/inline-queued-edit-lease.test.tsx": 2401, "src/renderer/src/components/native-chat/messages/agent-senders/native-chat-agent-message-sender-host.test.tsx": 8140, @@ -3749,7 +3738,6 @@ "src/renderer/src/components/native-chat/subagents/native-chat-subagent-handoff-copy-budget.test.ts": 362, "src/renderer/src/components/native-chat/pane/routing/native-chat-tab-directory.test.ts": 304, "src/renderer/src/components/native-chat/native-chat-task-list-state.test.ts": 62, - "src/renderer/src/components/native-chat/session/options/terminal/serialized-screen-background-rows.test.ts": 131, "src/renderer/src/components/native-chat/session/structured/delivery/structured-agent-session-message-hand-back.test.ts": 472, "src/renderer/src/components/native-chat/session/structured/delivery/structured-agent-session-message-sender.test.ts": 687, "src/renderer/src/components/native-chat/viewport/rail/structured-agent-session-rail-outline.test.ts": 48, @@ -3843,17 +3831,13 @@ "src/renderer/src/components/settings/advanced/network/NodeDistMirrorDialog.test.tsx": 2412, "src/renderer/src/components/plugins/list/PluginsSettingsSection.lifecycle.test.tsx": 5402, "src/renderer/src/components/settings/runtime-environments/pairing/RuntimePairingGeneratorForm.test.tsx": 461, - "src/renderer/src/components/settings/appearance/fonts/FontAutocomplete.test.tsx": 1202, - "src/renderer/src/components/settings/shortcuts/ShortcutsPane.provenance.test.tsx": 2302, "src/renderer/src/components/settings/repository/worktrees/SparsePresetSettingsSection.test.tsx": 744, "src/renderer/src/components/settings/tasks/TaskSourceSimpleSetup.test.tsx": 527, "src/renderer/src/components/settings/TerminalAppearanceSection.ghostty.test.ts": 549, "src/renderer/src/components/settings/terminal/session-management/TerminalLimitSetting.test.tsx": 1015, "src/renderer/src/components/settings/voice/VoicePane.test.tsx": 1042, "src/renderer/src/components/settings/accounts/sign-in/account-add-cancel-target.test.ts": 217, - "src/renderer/src/components/settings/accounts/usage/accounts-pane-opencode-credentials.test.ts": 519, "src/renderer/src/lib/agent-session/launch/agent-settings-update-queue.test.ts": 249, - "src/renderer/src/components/agent/launch-settings/agent-default-env-draft.test.ts": 54, "src/renderer/src/components/settings/developer-permissions/developer-permissions-search.test.ts": 308, "src/renderer/src/components/settings/shortcuts/keybinding-diagnostic-text.test.ts": 522, "src/renderer/src/components/settings/shortcuts/keybinding-title-copy.test.ts": 227, @@ -3934,7 +3918,6 @@ "src/renderer/src/components/tab-bar/tab-strip-pointer-activation.test.tsx": 2047, "src/renderer/src/components/tab-bar/use-agent-picker-refused-wake.test.tsx": 271, "src/renderer/src/components/tab-bar/use-new-tab-agent-menu-host-preferences.test.tsx": 3234, - "src/renderer/src/components/tab-bar/use-sortable-tab-context-menu.test.ts": 261, "src/renderer/src/components/tab-bar/use-tab-bar-quick-command-search-input.test.tsx": 536, "src/renderer/src/components/tab-group/RetainedPaneHost.test.tsx": 340, "src/renderer/src/components/tab-group/tab-drag-pointer-sensor.test.ts": 187, @@ -4113,7 +4096,6 @@ "src/renderer/src/components/terminal-parked-watcher-sync-entries.test.tsx": 1104, "src/renderer/src/components/terminal-quick-commands/TerminalQuickCommandDialog.test.tsx": 1916, "src/renderer/src/components/terminal-search-long-wrapped-line.test.ts": 4708, - "src/renderer/src/components/terminal-search-safe-find.test.ts": 45, "src/renderer/src/components/terminal-workspace-keydown.test.ts": 2213, "src/renderer/src/components/terminal/active-terminal-repair-loop.react185.test.tsx": 1998, "src/renderer/src/components/terminal/background-terminal-worktree-mount.test.ts": 1707, @@ -4727,7 +4709,6 @@ "src/shared/github/project-board-columns.test.ts": 64, "src/shared/github/project-identity.test.ts": 33, "src/shared/github/project-ref-input.test.ts": 40, - "src/shared/github/project-roadmap-timeline.test.ts": 72, "src/shared/github/pull-request-auto-merge-availability.test.ts": 52, "src/shared/github/repository-identity-key.test.ts": 39, "src/shared/grok-model-list-probe.test.ts": 54, @@ -5044,7 +5025,6 @@ "src/shared/structured-session-message-contracts.test.ts": 411, "src/shared/tab-agent-from-signals-pi-identity.test.ts": 103, "src/shared/task-query.test.ts": 55, - "src/shared/task-source-context.test.ts": 103, "src/shared/program-status/terminal-agent-status-processor.test.ts": 74, "src/shared/terminal/output/terminal-bell-detector.test.ts": 40, "src/shared/terminal/protocol/queries/terminal-color-scheme-protocol.test.ts": 39, @@ -5104,7 +5084,6 @@ "src/shared/windows-security-addon.test.ts": 51, "src/shared/windows-security-addon.win32.test.ts": 73, "src/shared/windows-transient-lock-removal.test.ts": 198, - "src/shared/work-item-empty-page.test.ts": 70, "src/shared/worker-auto-close.test.ts": 60, "src/shared/workspace-attachments/workspace-attachment-mutation.test.ts": 101, "src/shared/workspace-attachments/workspace-attachment-normalization.test.ts": 76, diff --git a/mobile/src/browser/page-interaction/browser-touch-geometry.test.ts b/mobile/src/browser/page-interaction/browser-touch-geometry.test.ts deleted file mode 100644 index fb0d15f46f3..00000000000 --- a/mobile/src/browser/page-interaction/browser-touch-geometry.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - browserWheelDeltaFromScreen, - computeBrowserFrameGeometry, - mapScreenToBrowserPoint -} from './browser-touch-geometry' - -const NO_ZOOM = { scale: 1, offsetX: 0, offsetY: 0 } - -// Measured Chromium 1217 (2026-09-20): no-viewport-meta page lays out at 980 CSS px within 402×593 emulation, scale 402/980. -// CDP takes viewport-relative CSS coordinates: divide device by scale without scroll offsets, which overshot a scrolled target by 300px. -const NO_VIEWPORT_META = { - deviceWidth: 402, - deviceHeight: 593, - pageScaleFactor: 0.41020408272743225, - scrollOffsetX: 0, - scrollOffsetY: 300 -} - -describe('browser touch geometry', () => { - it('divides the frame device space by the page scale and adds no scroll offset', () => { - const layout = { width: 400, height: 600 } - const metadata = { - deviceWidth: 400, - deviceHeight: 600, - pageScaleFactor: 0.5, - scrollOffsetX: 70, - scrollOffsetY: 300 - } - - expect(mapScreenToBrowserPoint(100, 200, layout, metadata, NO_ZOOM)).toEqual({ x: 200, y: 400 }) - }) - - it('scrolls the page by the page scale, not by the frame fit alone', () => { - const layout = { width: 402, height: 593 } - const geometry = computeBrowserFrameGeometry(layout, NO_VIEWPORT_META) - - // 100-screen-point flick spans 100/0.41 CSS pixels on default 980px page; frame fits pane 1:1. - const delta = browserWheelDeltaFromScreen(0, 100, geometry, 1) - - expect(delta.dy).toBe(-244) - expect(delta.dx).toBe(0) - }) -}) diff --git a/mobile/src/components/feedback/native-screen-recovery.test.tsx b/mobile/src/components/feedback/native-screen-recovery.test.tsx deleted file mode 100644 index 96a91d2bd40..00000000000 --- a/mobile/src/components/feedback/native-screen-recovery.test.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { createElement } from 'react' -import { act, create, type ReactTestRenderer } from 'react-test-renderer' -import { expect, it, vi } from 'vitest' -import { NativeScreenRecovery } from './NativeScreenRecovery' -import { connectionLogStore } from '../../diagnostics/connection/persisted-connection-log-store' -import { NATIVE_APP_LOG_ID } from '../../diagnostics/native-render-log' - -const navigation = vi.hoisted(() => ({ segments: ['about'] })) -vi.mock('expo-router', () => ({ - useRouter: () => ({ replace: () => {} }), - useSegments: () => navigation.segments -})) -vi.mock('react-native', () => ({ - Text: 'Text', - View: 'View', - Pressable: 'Pressable', - StyleSheet: { create: (styles: unknown) => styles } -})) -vi.mock('@react-native-async-storage/async-storage', () => ({ - default: { getItem: async () => null, setItem: async () => {} } -})) - -it('records the original failed route once when the unmounted layout resets router state', async () => { - const props = { error: new Error('render failed'), retry: async () => {} } - const mounted: { tree?: ReactTestRenderer } = {} - await act(async () => { - mounted.tree = create(createElement(NativeScreenRecovery, props)) - }) - const tree = mounted.tree - if (!tree) { - throw new Error('NativeScreenRecovery did not mount') - } - navigation.segments = [] - await act(async () => tree.update(createElement(NativeScreenRecovery, props))) - const entries = connectionLogStore.get(NATIVE_APP_LOG_ID) - expect(entries).toHaveLength(1) - expect(entries[0]?.detail).toContain('/about: Error') - await act(async () => tree.unmount()) -}) diff --git a/mobile/src/layout/fold-division.test.ts b/mobile/src/layout/fold-division.test.ts deleted file mode 100644 index 3bb167449a8..00000000000 --- a/mobile/src/layout/fold-division.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { getFoldSplit } from './fold-division' - -// Measured on the iPhone Duo simulator (iOS 27.1), inner display, half folded; the frames include -// the 20pt margins UIKit reserves on each side of the fold. -const INNER_LANDSCAPE = { x: 0, y: 0, width: 951, height: 669 } -const BOOK_FOLD = { x: 455.5, y: 0, width: 40, height: 669 } -const INNER_PORTRAIT = { x: 0, y: 0, width: 669, height: 951 } -const TABLETOP_FOLD = { x: 0, y: 455.5, width: 669, height: 40 } - -describe('getFoldSplit', () => { - it('splits left from right in book posture and top from bottom in tabletop posture', () => { - expect(getFoldSplit([BOOK_FOLD], INNER_LANDSCAPE)).toEqual({ - axis: 'vertical', - start: 455.5, - end: 495.5, - size: 951 - }) - expect(getFoldSplit([TABLETOP_FOLD], INNER_PORTRAIT)).toEqual({ - axis: 'horizontal', - start: 455.5, - end: 495.5, - size: 951 - }) - }) - - it('answers in the coordinates of a frame inset in the window', () => { - expect(getFoldSplit([BOOK_FOLD], { x: 59, y: 0, width: 808, height: 669 })).toEqual({ - axis: 'vertical', - start: 396.5, - end: 436.5, - size: 808 - }) - }) - - it('ignores a fold at the edge of a Split View window, which splits nothing', () => { - expect(getFoldSplit([BOOK_FOLD], { x: 0, y: 0, width: 469, height: 669 })).toBeNull() - expect(getFoldSplit([BOOK_FOLD], { x: 482, y: 0, width: 469, height: 669 })).toBeNull() - }) - - it('ignores a fold that does not cross the frame', () => { - expect(getFoldSplit([{ ...BOOK_FOLD, height: 300 }], INNER_LANDSCAPE)).toBeNull() - }) -}) diff --git a/mobile/src/new-workspace/creation/workspace-ssh-gate.test.ts b/mobile/src/new-workspace/creation/workspace-ssh-gate.test.ts deleted file mode 100644 index 39983fc49be..00000000000 --- a/mobile/src/new-workspace/creation/workspace-ssh-gate.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { deriveWorkspaceSshGate, type WorkspaceSshRecord } from './workspace-ssh-gate' - -describe('workspace SSH gate', () => { - it('ignores stale SSH state from a previously selected repository', () => { - expect( - deriveWorkspaceSshGate({ - connectionId: 'ssh-2', - state: { targetId: 'ssh-1', status: 'connected', error: null, reconnectAttempt: 0 }, - connecting: false - }) - ).toEqual({ - status: null, - requiresConnection: true, - connectInProgress: false, - error: null, - needsDesktopServerRecovery: false - }) - }) - - it('asks for the desktop recovery only for the refusal the desktop offers it on', () => { - const named = 'run `orcad --reclaim-stale-lock --data-root /home/dev/.orca` there' - const gate = (managedServer: WorkspaceSshRecord['managedServer']) => - deriveWorkspaceSshGate({ - connectionId: 'ssh-1', - state: { targetId: 'ssh-1', status: 'connected', managedServer }, - connecting: false - }).needsDesktopServerRecovery - const refused = { kind: 'managed', serving: { state: 'unverifiable', detail: named } } - expect(gate(refused)).toBe(true) - expect(gate({ ...refused, serving: { ...refused.serving, detail: 'did not answer' } })).toBe( - false - ) - expect(gate({ ...refused, kind: 'relay' })).toBe(false) - expect(gate({ ...refused, serving: { detail: named } })).toBe(false) - }) -}) diff --git a/src/main/browser/electron-fixtures/popup-identity-electron-probe.test.ts b/src/main/browser/electron-fixtures/popup-identity-electron-probe.test.ts deleted file mode 100644 index 609f2d65897..00000000000 --- a/src/main/browser/electron-fixtures/popup-identity-electron-probe.test.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { EventEmitter } from 'node:events' -import { existsSync, rmSync } from 'node:fs' -import { afterEach, expect, it, vi } from 'vitest' -import { - createPopupIdentityProbeRoot, - launchPopupIdentityProbe -} from './popup-identity-electron-probe' - -const mocks = vi.hoisted(() => ({ spawn: vi.fn(), closeBrowser: vi.fn() })) - -vi.mock('@orca/process-host', () => ({ spawnProcess: mocks.spawn })) -vi.mock('playwright', () => ({ - chromium: { connectOverCDP: vi.fn(async () => ({ close: mocks.closeBrowser })) } -})) -vi.mock('../identity/wire-probes/browser-session-ua-cdp-collector', () => ({ - waitForBrowserCdpEndpoint: vi.fn(async () => undefined) -})) - -const roots: string[] = [] - -afterEach(() => { - for (const root of roots.splice(0)) { - rmSync(root, { recursive: true, force: true }) - } - vi.clearAllMocks() -}) - -it.each([ - { exitCode: 0, signalCode: null }, - { exitCode: null, signalCode: 'SIGTERM' } -] as const)( - 'cleans up a probe whose child already exited with $exitCode / $signalCode', - async ({ exitCode, signalCode }) => { - const child = Object.assign(new EventEmitter(), { - stderr: new EventEmitter(), - exitCode, - signalCode, - kill: vi.fn() - }) - mocks.spawn.mockReturnValue(child) - const root = createPopupIdentityProbeRoot() - roots.push(root) - const probe = await launchPopupIdentityProbe(root) - child.emit('exit', exitCode, signalCode) - - await probe.stop() - - expect(mocks.closeBrowser).toHaveBeenCalledOnce() - expect(child.listenerCount('exit')).toBe(0) - expect(existsSync(root)).toBe(false) - }, - 2_000 -) diff --git a/src/main/crash-reporting/minidumps/minidump-file-source.test.ts b/src/main/crash-reporting/minidumps/minidump-file-source.test.ts deleted file mode 100644 index 105046442e9..00000000000 --- a/src/main/crash-reporting/minidumps/minidump-file-source.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { mkdtemp, open, rm, truncate, writeFile } from 'node:fs/promises' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { afterEach, expect, it } from 'vitest' -import { createMinidumpFileSource } from './minidump-file-source' -import { parseMinidumpCrashSignature } from './minidump-crash-signature' - -const roots: string[] = [] -const LINE = '[8104:1234:0815/143022.123456:FATAL:render_frame_impl.cc(4821)] Check failed: !x.' - -function header(): Buffer { - const bytes = Buffer.alloc(32) - bytes.writeUInt32LE(0x504d444d, 0) - bytes.writeUInt32LE(32, 12) - return bytes -} - -async function sourceFile() { - const root = await mkdtemp(join(tmpdir(), 'orca-minidump-source-')) - roots.push(root) - const path = join(root, 'dump.dmp') - await writeFile(path, header()) - return path -} - -afterEach(async () => { - await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true }))) -}) - -it('does not read outside the opened extent, including truncation and EOF', async () => { - const path = await sourceFile() - const handle = await open(path, 'r+') - try { - const source = createMinidumpFileSource(handle, 32) - await handle.write(Buffer.from(LINE), 0, LINE.length, 32) - expect(await source.read(32, 4)).toEqual(Buffer.alloc(0)) - expect((await parseMinidumpCrashSignature(source))?.checkMessage).toBeUndefined() - await truncate(path, 4) - const truncated = createMinidumpFileSource(handle, 32) - expect(await parseMinidumpCrashSignature(truncated)).toBeNull() - } finally { - await handle.close() - } -}) diff --git a/src/main/emulator/serve-sim-execution.test.ts b/src/main/emulator/serve-sim-execution.test.ts deleted file mode 100644 index e44963e9992..00000000000 --- a/src/main/emulator/serve-sim-execution.test.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { expect, it, vi } from 'vitest' - -const { runProcessMock } = vi.hoisted(() => ({ runProcessMock: vi.fn() })) - -vi.mock('@orca/process-host', () => ({ runProcess: runProcessMock })) - -import { execServeSimCommand } from './serve-sim-execution' - -// Shape of serve-sim 0.1.47's real `fold 180 -d -q` crash: the minified source line holds -// the "No serve-sim server running" text of every other command (#40509). -const UNCAUGHT_FOLD_FAILURE = `file:///Users/me/Library/Application Support/orca/serve-sim-runtime/1.4.255/node_modules/serve-sim/dist/serve-sim.js:161 -Shutting down...\`);async function GG($,Q){let Z=s(Q);if(!Z)console.error("No serve-sim server running. Run \`serve-sim\` first."),process.exit(1);let J=await C5(Z.wsUrl)} - - -Error: Simulator rejected the fold. An iPhone Duo with guest HID support is required. - at J.onmessage (file:///Users/me/Library/Application Support/orca/serve-sim-runtime/1.4.255/node_modules/serve-sim/dist/serve-sim.js:161:6107) - at callListener (/Users/me/node_modules/ws/lib/event-target.js:290:14) - -Node.js v24.22.1 -` - -it('reports the thrown serve-sim error instead of no active emulator', async () => { - runProcessMock.mockResolvedValueOnce({ - code: 1, - signal: null, - stdout: '', - stderr: UNCAUGHT_FOLD_FAILURE, - timedOut: false - }) - await expect( - execServeSimCommand({ command: 'serve-sim', baseArgs: [], usesElectronAsNode: false }, [ - 'fold', - '180' - ]) - ).rejects.toMatchObject({ - code: 'emulator_error', - message: 'Error: Simulator rejected the fold. An iPhone Duo with guest HID support is required.' - }) -}) diff --git a/src/main/git/worktrees/removal/worktree-delete-limit.test.ts b/src/main/git/worktrees/removal/worktree-delete-limit.test.ts deleted file mode 100644 index 3c6292dccde..00000000000 --- a/src/main/git/worktrees/removal/worktree-delete-limit.test.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - WORKTREE_DELETE_CONCURRENCY, - _worktreeDeleteLimitSnapshotForTests, - runUnderWorktreeDeleteLimit -} from './worktree-delete-limit' - -function deferred(): { promise: Promise; resolve: () => void } { - let resolve!: () => void - const promise = new Promise((settle) => { - resolve = settle - }) - return { promise, resolve } -} - -describe('runUnderWorktreeDeleteLimit', () => { - it('runs at most the limit at once and starts queued deletes in arrival order', async () => { - const gates = Array.from({ length: WORKTREE_DELETE_CONCURRENCY + 2 }, deferred) - const started: number[] = [] - const runs = gates.map((gate, index) => - runUnderWorktreeDeleteLimit(async () => { - started.push(index) - await gate.promise - }) - ) - await Promise.resolve() - - expect(started).toEqual([0, 1]) - expect(_worktreeDeleteLimitSnapshotForTests()).toEqual({ running: 2, waiting: 2 }) - - gates[1]?.resolve() - await runs[1] - await Promise.resolve() - expect(started).toEqual([0, 1, 2]) - - gates[0]?.resolve() - gates[2]?.resolve() - gates[3]?.resolve() - await Promise.all(runs) - expect(started).toEqual([0, 1, 2, 3]) - expect(_worktreeDeleteLimitSnapshotForTests()).toEqual({ running: 0, waiting: 0 }) - }) - - it('frees the slot when a delete fails', async () => { - await expect( - runUnderWorktreeDeleteLimit(async () => { - throw new Error('locked') - }) - ).rejects.toThrow('locked') - expect(_worktreeDeleteLimitSnapshotForTests()).toEqual({ running: 0, waiting: 0 }) - }) -}) diff --git a/src/main/git/worktrees/removal/worktree-delete-limit.ts b/src/main/git/worktrees/removal/worktree-delete-limit.ts index 462ef4575b0..62f95fab9f3 100644 --- a/src/main/git/worktrees/removal/worktree-delete-limit.ts +++ b/src/main/git/worktrees/removal/worktree-delete-limit.ts @@ -22,7 +22,3 @@ export async function runUnderWorktreeDeleteLimit(operation: () => Promise } } } - -export function _worktreeDeleteLimitSnapshotForTests(): { running: number; waiting: number } { - return { running, waiting: waiting.length } -} diff --git a/src/main/ipc/terminal-startup-color-query-replies.test.ts b/src/main/ipc/terminal-startup-color-query-replies.test.ts deleted file mode 100644 index 376081286c9..00000000000 --- a/src/main/ipc/terminal-startup-color-query-replies.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { getStartupTerminalIngressIntent } from './terminal-startup-color-query-replies' -import { PtyStartupIngress } from '../../shared/terminal/pty/ingress/pty-startup-ingress' -import { parsePtyStartupIngressIntent } from '../../shared/terminal/pty/ingress/pty-startup-ingress-intent' - -describe('the first OSC 11 reply of a terminal a paired client created (#34340)', () => { - const HOST_WINDOW = { foreground: '#000000', background: '#ffffff' } - const CLIENT = { foreground: '#ffffff', background: '#282c34' } - - // Spawn assembly -> daemon wire (JSON + the owner's parse) -> owner reply, with the host window's theme host-wide. - function firstBackgroundReply(launch: Parameters[0]) { - const intent = parsePtyStartupIngressIntent( - JSON.parse(JSON.stringify(getStartupTerminalIngressIntent(launch))) - ) - const writes: string[] = [] - const ingress = new PtyStartupIngress({ - ...(intent ? { intent } : {}), - ownerBackend: 'posix-pty', - resolveHostColors: () => HOST_WINDOW, - write: (data) => writes.push(data), - onEmission: () => {} - }) - ingress.accept('\x1b]11;?\x07') - ingress.drainAndClose() - return writes - } - - it("answers with the launching client's background, not the host window's", () => { - expect( - firstBackgroundReply({ - command: 'codex', - terminalColorQueryReplies: HOST_WINDOW, - launcherColorQueryReplies: CLIENT - }) - ).toEqual(['\x1b]11;rgb:2828/2c2c/3434\x1b\\']) - }) -}) diff --git a/src/main/local-builds/local-build-feed-server.test.ts b/src/main/local-builds/local-build-feed-server.test.ts deleted file mode 100644 index 6c020c10fef..00000000000 --- a/src/main/local-builds/local-build-feed-server.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { mkdtemp, open, rm, writeFile } from 'node:fs/promises' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { describe, expect, it } from 'vitest' -import type { LocalBuildCandidate } from './local-build-candidate' -import { startLocalBuildFeed } from './local-build-feed-server' - -describe('startLocalBuildFeed', () => { - it('serves only tokenized manifest and validated artifact routes', async () => { - const directory = await mkdtemp(join(tmpdir(), 'orca-local-feed-')) - const artifactPath = join(directory, 'orca-macos-arm64.zip') - await writeFile(artifactPath, 'zip') - const artifactFile = await open(artifactPath, 'r') - const candidate = { - version: '1.2.3-local.1', - manifestContent: 'version: 1.2.3-local.1\n', - artifacts: new Map([['orca-macos-arm64.zip', { file: artifactFile, size: 3 }]]), - close: () => artifactFile.close() - } as LocalBuildCandidate - const feed = await startLocalBuildFeed(candidate) - try { - await expect( - fetch(`${feed.url}latest-mac.yml`).then((response) => response.text()) - ).resolves.toContain('1.2.3-local.1') - await expect( - fetch(`${feed.url}orca-macos-arm64.zip`).then((response) => response.text()) - ).resolves.toBe('zip') - const baseUrl = new URL(feed.url) - await expect( - fetch(`${baseUrl.origin}/latest-mac.yml`).then((response) => response.status) - ).resolves.toBe(404) - } finally { - await feed.close() - await rm(directory, { recursive: true, force: true }) - } - }) -}) diff --git a/src/main/orcad/daemon/orcad-daemon-supervision.test.ts b/src/main/orcad/daemon/orcad-daemon-supervision.test.ts deleted file mode 100644 index 5b3ec17e647..00000000000 --- a/src/main/orcad/daemon/orcad-daemon-supervision.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { afterEach, describe, expect, it, vi } from 'vitest' - -const initDaemonPtyProvider = vi.hoisted(() => vi.fn()) -vi.mock('../../daemon/providers/lifecycle/daemon-provider-init', () => ({ initDaemonPtyProvider })) - -import { startOrcadDaemon } from './orcad-daemon-supervision' -import { OrcadTerminalsNotDurableError } from '../serve-startup/orcad-serve-supervision' -import { resolveOrcadExitCode } from '../serve-startup/orcad-exit-code' -import { - ORCA_SERVE_SUPERVISED_ENV, - ORCAD_EXIT_TERMINALS_NOT_DURABLE -} from '../../../shared/remote-runtime/serve-supervisor/serve-supervised-terminal-durability' - -afterEach(() => { - vi.restoreAllMocks() - delete process.env[ORCA_SERVE_SUPERVISED_ENV] -}) - -describe('startOrcadDaemon', () => { - it('refuses to serve a supervised host whose terminals would die with it', async () => { - vi.spyOn(console, 'warn').mockImplementation(() => {}) - vi.spyOn(console, 'error').mockImplementation(() => {}) - initDaemonPtyProvider.mockRejectedValue(new Error('daemon health check rejected')) - - process.env[ORCA_SERVE_SUPERVISED_ENV] = '1' - const supervised = startOrcadDaemon('linux') - await expect(supervised).rejects.toBeInstanceOf(OrcadTerminalsNotDurableError) - const error = await supervised.catch((caught: unknown) => caught) - expect(resolveOrcadExitCode(error)).toBe(ORCAD_EXIT_TERMINALS_NOT_DURABLE) - expect(String(error)).toContain('daemon health check rejected') - expect(process.env[ORCA_SERVE_SUPERVISED_ENV]).toBeUndefined() - - await expect(startOrcadDaemon('linux')).resolves.toMatchObject({ - state: 'unavailable' - }) - }) -}) diff --git a/src/main/persistence/terminal-topology/pane-moves/terminal-leaf-move-concurrent-close.test.ts b/src/main/persistence/terminal-topology/pane-moves/terminal-leaf-move-concurrent-close.test.ts deleted file mode 100644 index 5388c811229..00000000000 --- a/src/main/persistence/terminal-topology/pane-moves/terminal-leaf-move-concurrent-close.test.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { tmpdir } from 'node:os' -import { afterEach, expect, it, vi } from 'vitest' - -import '../../persistence-test-harness' -import { - closeMoveTestStores, - MOVED, - moveRequest, - newDataFile, - openStore, - seedSplitSource, - SOURCE, - TARGET, - tabsHoldingLeaf, - WT -} from '../testing/terminal-leaf-move-fixture' -import '../terminal-topology-commit' - -vi.mock('electron', () => ({ - app: { - getPath: () => tmpdir(), - getName: () => 'orca-test', - getVersion: () => '0.0.0-test', - isPackaged: false, - on: () => {}, - whenReady: () => Promise.resolve() - }, - safeStorage: { - isEncryptionAvailable: () => false, - encryptString: (value: string) => Buffer.from(value), - decryptString: (value: Buffer) => value.toString() - }, - ipcMain: { on: () => {}, handle: () => {} }, - BrowserWindow: { getAllWindows: () => [] } -})) - -afterEach(closeMoveTestStores) - -const request = { ...moveRequest, ptyId: 'pty-agent' } - -// The renderer completes a post-move close against main's new tab. - -// In-flight drags must refuse: a spawn without captured PTY identity can recreate SOURCE:leaf after move. -it('grafts a late spawn result for the moved leaf back into its source tab', async () => { - const store = openStore(newDataFile()) - await seedSplitSource(store) - await store.moveTerminalLeafToNewTab({ ...request, ptyId: null }) - await store.persistPtyBinding({ - worktreeId: WT, - tabId: SOURCE, - leafId: MOVED, - ptyId: 'pty-late', - incarnationId: 'inc-late' - }) - expect(tabsHoldingLeaf(store.getWorkspaceSession(), MOVED).sort()).toEqual([SOURCE, TARGET]) -}) diff --git a/src/main/runtime/rpc/methods/workspaces/worktree-create-exact-name.test.ts b/src/main/runtime/rpc/methods/workspaces/worktree-create-exact-name.test.ts deleted file mode 100644 index 3d4ecdf4b43..00000000000 --- a/src/main/runtime/rpc/methods/workspaces/worktree-create-exact-name.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -import '../../dispatch/testing/unused-default-rpc-methods.test-fixture' -import { expect, it, vi } from 'vitest' -import { RpcDispatcher } from '../../dispatcher' -import type { OrcaRuntimeService } from '../../../orca-runtime' -import { WORKTREE_METHODS } from './worktree' -import { WorktreeCreateExactNameTakenError } from '../../../../../shared/new-workspace/worktree-create-collision' - -// The folder shortcut opens the composer only on this code; runtime_error would toast instead. -it('keeps the exact-name refusal code on worktree.create', async () => { - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the create handler reads only these members. - const runtime = { - getRuntimeId: () => 'test-runtime', - showRepo: vi.fn().mockResolvedValue({ - id: 'repo-1', - path: '/workspace/repo', - displayName: 'repo', - badgeColor: '#000', - addedAt: 1, - kind: 'git' - }), - dedupeWorktreeCreate: (_repo: string, _id: string | undefined, run: () => Promise) => - run(), - createManagedWorktree: vi - .fn() - .mockRejectedValue(new WorktreeCreateExactNameTakenError('"child" is already taken.')) - } as unknown as OrcaRuntimeService - const dispatcher = new RpcDispatcher({ runtime, methods: WORKTREE_METHODS }) - - const response = await dispatcher.dispatch({ - id: 'req-1', - authToken: 'tok', - method: 'worktree.create', - params: { repo: 'repo-1', name: 'child', branchIntent: 'create-exact' } - }) - - expect(response).toMatchObject({ ok: false, error: { code: 'worktree_create_exact_name_taken' } }) -}) diff --git a/src/main/runtime/session-lifecycle/projection/sleep-record-pane-claim.test.ts b/src/main/runtime/session-lifecycle/projection/sleep-record-pane-claim.test.ts deleted file mode 100644 index 5c0fb663960..00000000000 --- a/src/main/runtime/session-lifecycle/projection/sleep-record-pane-claim.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { SleepingAgentSessionRecord } from '../../../../shared/agent-session/lifecycle/agent-session-resume' -import type { WorkspaceSessionState } from '../../../../shared/workspace-session/workspace-session-state-types' -import { markResumedRecordLive } from './sleep-record-pane-claim' - -const PANE_KEY = 'tab-1:leaf-1' -const RESUMED: SleepingAgentSessionRecord = { - paneKey: PANE_KEY, - tabId: 'tab-1', - worktreeId: 'repo::/work', - agent: 'claude', - providerSession: { key: 'session_id', id: 'conv-1' }, - prompt: '', - state: 'done', - capturedAt: 1, - updatedAt: 1, - origin: 'worktree-sleep' -} - -async function markedRecord(stored: SleepingAgentSessionRecord) { - // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the edit reads only the records. - let session = { - sleepingAgentSessionsByPaneKey: { [PANE_KEY]: stored } - } as unknown as WorkspaceSessionState - await markResumedRecordLive( - async (edit) => { - session = edit(session) ?? session - }, - PANE_KEY, - RESUMED - ) - return session.sleepingAgentSessionsByPaneKey?.[PANE_KEY] -} - -describe('marking a resumed pane record live', () => { - it('turns the record the start resumed from into a running agent’s', async () => { - expect(await markedRecord(RESUMED)).toMatchObject({ origin: 'live', capturedAt: 1 }) - }) - - it('leaves a sleep of the pane captured after the start', async () => { - const sleptAgain = { ...RESUMED, capturedAt: 2, updatedAt: 2 } - expect(await markedRecord(sleptAgain)).toEqual(sleptAgain) - }) -}) diff --git a/src/main/runtime/terminal/layout/paired-desktop-server-writes-layout-owner.test.ts b/src/main/runtime/terminal/layout/paired-desktop-server-writes-layout-owner.test.ts deleted file mode 100644 index f1b49642bbe..00000000000 --- a/src/main/runtime/terminal/layout/paired-desktop-server-writes-layout-owner.test.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Paired close uses session.tabs.close to stop host terminals; window-style layout.apply assumes its window already stopped them. -import { describe, expect, it, vi } from 'vitest' -import { - PTY_A, - TAB_ID, - WORKTREE_ID, - setupMainOwnedWorkspace -} from './main-owned-workspace-runtime-fixture' - -vi.mock('../../../../shared/layout-owner-switch', () => ({ ORCA_LAYOUT_OWNER_IS_MAIN: true })) - -type Fixture = Awaited> - -const tabRow = (fixture: Fixture) => - fixture.session().tabsByWorktree[WORKTREE_ID]?.find((tab) => tab.id === TAB_ID) - -/** session.tabs.close as the desktop sends it: the host tab id, a user reason, no force. */ -const desktopClose = (fixture: Fixture) => - fixture.runtime.closeMobileSessionTab(`id:${WORKTREE_ID}`, TAB_ID, { - reason: 'user', - clientNavigationId: 'paired-desktop' - }) - -// This harness has no renderer publication, so only main-owned session rows exist. -describe('a paired desktop’s close of a tab a server’s main owns, with no window', () => { - it('closes the tab in main’s layout and stops its terminal', async () => { - const fixture = await setupMainOwnedWorkspace() - - await desktopClose(fixture) - - expect(tabRow(fixture)).toBeUndefined() - expect(fixture.stopped).toEqual([PTY_A]) - }) - - it('refuses a pinned tab, keeping it and its terminal', async () => { - const fixture = await setupMainOwnedWorkspace({ pinned: true }) - - await expect(desktopClose(fixture)).rejects.toThrow('terminal_tab_pinned') - - expect(tabRow(fixture)).toBeDefined() - expect(fixture.stopped).toEqual([]) - }) -}) diff --git a/src/main/ssh/host-server/ssh-host-server-on-connect-telemetry.test.ts b/src/main/ssh/host-server/ssh-host-server-on-connect-telemetry.test.ts deleted file mode 100644 index 6964a7fb02f..00000000000 --- a/src/main/ssh/host-server/ssh-host-server-on-connect-telemetry.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import type { SshTarget } from '../../../shared/remote-runtime/ssh/ssh-types' - -import type { HostServerConnectEvent } from './ssh-host-server-connect-events' -import { - resolveHostServerOnConnect, - type HostServerOnConnectDeps -} from './ssh-host-server-on-connect' -import { hostServerDepsStub } from './testing/ssh-host-server-on-connect-test-deps' - -const target: SshTarget = { id: 'ssh-1', label: 'Box', host: 'box', port: 22, username: 'me' } - -const deps = hostServerDepsStub - -async function eventsOf(d: HostServerOnConnectDeps): Promise { - await resolveHostServerOnConnect(target, d).catch(() => undefined) - return vi.mocked(d.report).mock.calls.map(([, event]) => event) -} - -function decided(events: HostServerConnectEvent[]) { - const found = events.filter((event) => event.kind === 'decided') - expect(found).toHaveLength(1) - return found[0] -} - -describe('connect-decision telemetry', () => { - it('still reports, as failed, a decision that throws, and a throwing reporter never fails a connect', async () => { - const d = deps({ - managedEnvironmentId: () => 'env-9', - ensureTunnel: async () => { - throw new Error('tunnel failed') - } - }) - expect(decided(await eventsOf(d))).toMatchObject({ outcome: 'relay', reason: 'failed' }) - - const throwing = deps({ - report: () => { - throw new Error('telemetry broke') - } - }) - await expect(resolveHostServerOnConnect(target, throwing)).resolves.toMatchObject({ - route: 'managed' - }) - }) -}) diff --git a/src/main/ssh/targets/ssh-target-route-resolution.test.ts b/src/main/ssh/targets/ssh-target-route-resolution.test.ts deleted file mode 100644 index 4c1be098f1d..00000000000 --- a/src/main/ssh/targets/ssh-target-route-resolution.test.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { SshTarget } from '../../../shared/remote-runtime/ssh/ssh-types' -import { parseSshGOutput } from '../config/ssh-g-config-resolution' -import { resolveSshRouteKeys } from './ssh-target-route-resolution' - -const target = (index: number): SshTarget => ({ - id: `ssh-${index}`, - label: `host-${index}`, - configHost: `host-${index}`, - host: `host-${index}`, - port: 22, - username: '', - source: 'ssh-config' -}) - -describe('resolveSshRouteKeys', () => { - it('runs at most four ssh -G at once', async () => { - let active = 0 - let peak = 0 - const waiting: (() => void)[] = [] - const answer = (alias: string) => parseSshGOutput(`hostname ${alias}\nuser me\nport 22`) - const config = async (alias: string) => { - active += 1 - peak = Math.max(peak, active) - await new Promise((release) => waiting.push(release)) - active -= 1 - return answer(alias) - } - const resolvers = { - config, - systemRoute: async (route: SshTarget) => answer(route.configHost ?? route.host), - aliasClaimed: () => true - } - const targets = Array.from({ length: 12 }, (_, index) => target(index)) - - const lookups = resolveSshRouteKeys(targets, resolvers) - let released = 0 - for (let spins = 0; released < targets.length && spins < 1000; spins += 1) { - const release = waiting.shift() - if (release) { - released += 1 - release() - } - await Promise.resolve() - } - await lookups - - expect(released).toBe(targets.length) - - expect(peak).toBe(4) - }) -}) diff --git a/src/renderer/src/components/agent/launch-settings/agent-default-env-draft.test.ts b/src/renderer/src/components/agent/launch-settings/agent-default-env-draft.test.ts deleted file mode 100644 index 3949742d047..00000000000 --- a/src/renderer/src/components/agent/launch-settings/agent-default-env-draft.test.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { - AGENT_DEFAULT_ENV_DRAFT_MAX_BYTES, - parseAgentDefaultEnvDraft, - stringifyAgentDefaultEnvDraft -} from './agent-default-env-draft' - -describe('agent default environment draft', () => { - it('parses back every value it formats', () => { - const env = { - SPACED: 'two words', - APOSTROPHE: "it's", - DOUBLE: 'say "hi"', - BOTH: `it's "x"`, - EQUALS: 'a=b', - EMPTY: '', - WIN_PATH: 'C:\\Program Files\\tool', - TAB: 'a\tb', - PLAIN: 'keep' - } - - expect(parseAgentDefaultEnvDraft(stringifyAgentDefaultEnvDraft(env))).toEqual({ - env, - invalidReason: null - }) - }) - - it('keeps backslashes typed without quotes', () => { - expect(parseAgentDefaultEnvDraft('TOOL=C:\\tools\\bin').env).toEqual({ - TOOL: 'C:\\tools\\bin' - }) - }) - - it('rejects a draft with an unclosed quote', () => { - expect(parseAgentDefaultEnvDraft('A="two words B=keep')).toEqual({ - env: {}, - invalidReason: 'unclosed-quote' - }) - }) - - it('splits pasted entries on any whitespace and skips words without a name', () => { - const draft = ['FOO=bar', String.fromCharCode(160), 'BAZ=qux\nSKIP\tTOKEN=value=kept'].join('') - - expect(parseAgentDefaultEnvDraft(draft)).toEqual({ - env: { FOO: 'bar', BAZ: 'qux', TOKEN: 'value=kept' }, - invalidReason: null - }) - }) - - it('rejects oversized pasted environment drafts', () => { - const draft = 'SECRET=value '.repeat(AGENT_DEFAULT_ENV_DRAFT_MAX_BYTES) - - expect(parseAgentDefaultEnvDraft(draft)).toEqual({ env: {}, invalidReason: 'too-large' }) - }) -}) diff --git a/src/renderer/src/components/native-chat/session/options/terminal/claude-model-switch-confirmation.test.ts b/src/renderer/src/components/native-chat/session/options/terminal/claude-model-switch-confirmation.test.ts deleted file mode 100644 index aa543c8b397..00000000000 --- a/src/renderer/src/components/native-chat/session/options/terminal/claude-model-switch-confirmation.test.ts +++ /dev/null @@ -1,29 +0,0 @@ -// @vitest-environment happy-dom - -import { describe, expect, it, vi } from 'vitest' -import { createClaudeModelSwitchConfirmationObserver } from './claude-model-switch-confirmation' - -describe('Claude model switch confirmation detection', () => { - it('reports matching success output split across PTY chunks', async () => { - const dataObserver = { current: (_data: string): void => {} } - const unsubscribe = vi.fn(() => {}) - const observer = createClaudeModelSwitchConfirmationObserver({ - ptyId: 'pty-1', - expectedModelLabel: 'Fable 5', - subscribeToData: (watcher) => { - dataObserver.current = watcher - return unsubscribe - }, - timeoutMs: 100 - }) - - await observer.ready - dataObserver.current('historical Set model to Fable 5') - observer.arm() - dataObserver.current('\u001b[2mSet\u001b[10Gmo') - dataObserver.current('del\u001b[16Gto\u001b[19GFable 5 and saved as your default\u001b[0m') - - await expect(observer.result).resolves.toBe('applied') - expect(unsubscribe).toHaveBeenCalledOnce() - }) -}) diff --git a/src/renderer/src/components/native-chat/session/options/terminal/serialized-screen-background-rows.test.ts b/src/renderer/src/components/native-chat/session/options/terminal/serialized-screen-background-rows.test.ts deleted file mode 100644 index ff50d589d04..00000000000 --- a/src/renderer/src/components/native-chat/session/options/terminal/serialized-screen-background-rows.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -/** Text readers must ignore serialized trailing background-only rows retained by full-screen TUIs such as OpenCode. */ -import { describe, expect, it } from 'vitest' -import { Terminal } from '@xterm/headless' -import { SerializeAddon } from '@xterm/addon-serialize' -import { readClaudeSessionOptionsFromTerminalScreen } from './claude-terminal-session-options' -import { buildBoundedSessionTranscript } from '@/lib/agent-session/context/agent-session-fork-context' - -const CLAUDE_FRAME = [ - '╭─ Claude Code ───╮', - '│Haiku 4.5│', - '│API Usage Billing│', - '│C:\\work\\repo│', - '╰─────────────╯', - '────────────────────────────────────────', - '❯ ', - '────────────────────────────────────────' -].join('\r\n') - -async function serializedScreen(paintBackgroundBelow: boolean): Promise { - const terminal = new Terminal({ cols: 40, rows: 14, allowProposedApi: true }) - const serializer = new SerializeAddon() - terminal.loadAddon(serializer) - const below = paintBackgroundBelow ? '\x1b[s\x1b[9;1H\x1b[48;5;236m\x1b[J\x1b[0m\x1b[u' : '' - await new Promise((resolve) => - terminal.write(`\x1b[?1049h\x1b[H${CLAUDE_FRAME}\x1b[7;3H${below}`, resolve) - ) - const screen = serializer.serialize({ scrollback: 0 }) - terminal.dispose() - return screen -} - -describe('text readers of a serialized screen with trailing background rows', () => { - it('read the same model and transcript as without them', async () => { - const plain = await serializedScreen(false) - const painted = await serializedScreen(true) - // Precondition: the painted screen really carries the kept background rows. - expect(painted).toContain(`\r\n\x1b[48;5;236m\x1b[40X${'\r\n\x1b[40X'.repeat(5)}`) - - expect(readClaudeSessionOptionsFromTerminalScreen(painted)).toEqual({ model: 'haiku' }) - expect(readClaudeSessionOptionsFromTerminalScreen(painted)).toEqual( - readClaudeSessionOptionsFromTerminalScreen(plain) - ) - expect(buildBoundedSessionTranscript(painted)).toBe(buildBoundedSessionTranscript(plain)) - }) -}) diff --git a/src/renderer/src/components/settings/accounts/usage/accounts-pane-opencode-credentials.test.ts b/src/renderer/src/components/settings/accounts/usage/accounts-pane-opencode-credentials.test.ts deleted file mode 100644 index 7f137a41aac..00000000000 --- a/src/renderer/src/components/settings/accounts/usage/accounts-pane-opencode-credentials.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -// @vitest-environment happy-dom -import { createElement } from 'react' -import { act, cleanup, fireEvent, render, screen } from '@testing-library/react' -import { afterEach, describe, expect, it, vi } from 'vitest' -import { OpenCodeGoCredentials } from './accounts-pane-opencode-credentials' - -vi.mock('../../../../store/index', () => ({ - useAppStore: (selector: (state: { settingsSearchQuery: string }) => unknown) => - selector({ settingsSearchQuery: '' }) -})) - -afterEach(() => { - cleanup() - vi.restoreAllMocks() - vi.unstubAllGlobals() -}) - -describe('OpenCode Go credentials setting', () => { - it('keeps a saved status when the initial read resolves afterward', async () => { - const initialStatus = Promise.withResolvers<{ apiKeyConfigured: boolean }>() - const getStatus = vi.fn(() => initialStatus.promise) - const saveApiKey = vi.fn(async () => ({ apiKeyConfigured: true })) - const clearApiKey = vi.fn(async () => ({ apiKeyConfigured: false })) - Object.defineProperty(window, 'api', { - configurable: true, - value: { - opencodeGoCredentials: { getStatus, saveApiKey, clearApiKey } - } - }) - - render(createElement(OpenCodeGoCredentials, { onSaved: vi.fn() })) - const input = screen.getByLabelText('OpenCode Go API key') - fireEvent.change(input, { target: { value: 'fake-new-key' } }) - fireEvent.click(screen.getByRole('button', { name: 'Save' })) - - await screen.findByText('Saved') - await act(async () => { - initialStatus.resolve({ apiKeyConfigured: false }) - await Promise.resolve() - }) - - expect(screen.getByText('Saved')).toBeTruthy() - }) -}) diff --git a/src/renderer/src/components/settings/appearance/fonts/FontAutocomplete.test.tsx b/src/renderer/src/components/settings/appearance/fonts/FontAutocomplete.test.tsx deleted file mode 100644 index 10dbc87e0ef..00000000000 --- a/src/renderer/src/components/settings/appearance/fonts/FontAutocomplete.test.tsx +++ /dev/null @@ -1,85 +0,0 @@ -// @vitest-environment happy-dom - -// @vitest-environment happy-dom -import { act } from 'react' -import { createRoot, type Root } from 'react-dom/client' -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' -import { FontAutocomplete } from './FontAutocomplete' - -vi.mock('@/i18n/i18n', () => ({ - translate: (_key: string, defaultValue: string) => defaultValue -})) - -describe('FontAutocomplete', () => { - let container: HTMLDivElement - let root: Root - - beforeEach(() => { - globalThis.IS_REACT_ACT_ENVIRONMENT = true - container = document.createElement('div') - document.body.appendChild(container) - root = createRoot(container) - }) - - afterEach(() => { - act(() => root.unmount()) - document.body.replaceChildren() - }) - - function getInput(): HTMLInputElement { - const input = container.querySelector('input[role="combobox"]') - if (!input) { - throw new Error('Font autocomplete input not found') - } - return input - } - - async function typeIntoInput(input: HTMLInputElement, value: string): Promise { - await act(async () => { - // Use the native setter so React’s controlled-input tracker recognizes the synthetic event. - const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set - setValue?.call(input, value) - input.dispatchEvent(new Event('input', { bubbles: true })) - }) - } - - async function pressInputKey( - input: HTMLInputElement, - key: string, - options?: { isComposing?: boolean } - ): Promise { - await act(async () => { - const event = new KeyboardEvent('keydown', { key, bubbles: true }) - if (options?.isComposing !== undefined) { - Object.defineProperty(event, 'isComposing', { value: options.isComposing }) - } - input.dispatchEvent(event) - }) - } - - it.each([ - { query: 'Geor', description: 'a highlighted suggestion' }, - { query: 'My Custom Font', description: 'a manual font name' } - ])('does not commit $description when Enter confirms IME composition', async ({ query }) => { - const change = vi.fn() - await act(async () => { - root.render( - - ) - }) - const input = getInput() - await act(async () => input.focus()) - await typeIntoInput(input, query) - - await pressInputKey(input, 'Enter', { isComposing: true }) - - expect(input.value).toBe(query) - expect(change).not.toHaveBeenCalled() - expect(input.getAttribute('aria-expanded')).toBe('true') - }) -}) diff --git a/src/renderer/src/components/settings/shortcuts/ShortcutsPane.provenance.test.tsx b/src/renderer/src/components/settings/shortcuts/ShortcutsPane.provenance.test.tsx deleted file mode 100644 index 96d027fd30f..00000000000 --- a/src/renderer/src/components/settings/shortcuts/ShortcutsPane.provenance.test.tsx +++ /dev/null @@ -1,76 +0,0 @@ -// @vitest-environment happy-dom -import React from 'react' -import { act, cleanup, fireEvent, render, screen } from '@testing-library/react' -import { afterEach, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store/index' -import type { ShortcutRowsList } from './ShortcutRowsList' -import { ShortcutsPane } from './ShortcutsPane' - -vi.hoisted(() => vi.stubGlobal('navigator', { userAgent: 'Macintosh' })) -const fixtures = vi.hoisted(() => ({ - empty: [], - chord: { key: 'j', code: 'KeyJ', metaKey: true, shiftKey: true } -})) -vi.mock('@/store/plugins/catalog/plugin-contribution-catalog', () => ({ - useEditablePluginCommands: () => fixtures.empty -})) -vi.mock('./use-mac-captured-digit-chords', () => ({ - useMacCapturedDigitChords: () => fixtures.empty -})) -vi.mock('./KeybindingsFileActions', () => ({ KeybindingsFileActions: () => null })) -vi.mock('./ShortcutTerminalPolicyControl', () => ({ ShortcutTerminalPolicyControl: () => null })) -vi.mock('./ShortcutRowsList', () => ({ - ShortcutRowsList: (props: React.ComponentProps) => ( - <> - - - {props.errors['terminal.toggleNativeChat']} - - ) -})) - -afterEach(() => { - cleanup() - vi.unstubAllGlobals() -}) - -it('retyping a nominal default resets unless a common override requires an explicit conflicting mask', async () => { - vi.stubGlobal('api', { ui: { setShortcutRecorderFocused: vi.fn() } }) - const reset = vi.fn().mockResolvedValue(undefined) - const set = vi.fn().mockResolvedValue(undefined) - const common = { 'terminal.toggleNativeChat': ['Mod+Alt+K'] } - const keybindings = { ...common, 'worktree.navigateDown': ['Mod+Shift+J'] } - useAppStore.setState({ - keybindings, - keybindingSnapshot: null, - resetKeybindingOverride: reset, - setKeybindingOverride: set - }) - render() - fireEvent.click(screen.getByText('Record')) - await act(async () => fireEvent.click(screen.getByText('Capture'))) - expect(reset).toHaveBeenCalledWith('terminal.toggleNativeChat') - reset.mockClear() - act(() => - useAppStore.setState({ - keybindingSnapshot: { - path: '/tmp/pr31679-keybindings.json', - exists: true, - platform: 'darwin', - overrides: keybindings, - commonOverrides: common, - platformOverrides: {}, - diagnostics: [] - } - }) - ) - fireEvent.click(screen.getByText('Record')) - await act(async () => fireEvent.click(screen.getByText('Capture'))) - expect(screen.getByText(/conflicts with/)).toBeTruthy() - expect(reset).not.toHaveBeenCalled() - expect(set).not.toHaveBeenCalled() -}) diff --git a/src/renderer/src/components/settings/shortcuts/ShortcutsPane.recorder-click-away.test.tsx b/src/renderer/src/components/settings/shortcuts/ShortcutsPane.recorder-click-away.test.tsx deleted file mode 100644 index 29acc1df0ba..00000000000 --- a/src/renderer/src/components/settings/shortcuts/ShortcutsPane.recorder-click-away.test.tsx +++ /dev/null @@ -1,77 +0,0 @@ -// @vitest-environment happy-dom -import { act, cleanup, fireEvent, render, screen } from '@testing-library/react' -import { afterEach, expect, it, vi } from 'vitest' -import { useAppStore } from '@/store/index' -import { TooltipProvider } from '@/components/ui/tooltip' -import { ShortcutsPane } from './ShortcutsPane' - -vi.hoisted(() => vi.stubGlobal('navigator', { userAgent: 'Macintosh' })) -const fixtures = vi.hoisted(() => ({ empty: [] })) -vi.mock('@/store/plugins/catalog/plugin-contribution-catalog', () => ({ - useEditablePluginCommands: () => fixtures.empty -})) -vi.mock('./use-mac-captured-digit-chords', () => ({ - useMacCapturedDigitChords: () => fixtures.empty -})) -vi.mock('./KeybindingsFileActions', () => ({ KeybindingsFileActions: () => null })) -vi.mock('./ShortcutTerminalPolicyControl', () => ({ ShortcutTerminalPolicyControl: () => null })) - -afterEach(() => { - cleanup() - vi.unstubAllGlobals() -}) - -async function renderPaneWithConflict(): Promise { - useAppStore.setState({ - keybindings: { 'worktree.palette': ['Mod+J'], 'terminal.clear': ['Mod+K'] }, - keybindingSnapshot: null - }) - render( - - - - ) - const recorder = screen.getByRole('button', { name: 'Change shortcut for Switch worktree' }) - fireEvent.click(recorder) - await act(async () => { - fireEvent.keyDown(recorder, { key: 'k', code: 'KeyK', metaKey: true }) - }) - expect(screen.queryByText(/conflicts with/)).not.toBeNull() - return recorder -} - -it('keeps recording across a window switch and stops on a click elsewhere, keeping the error', async () => { - const setShortcutRecorderFocused = vi.fn() - vi.stubGlobal('api', { ui: { setShortcutRecorderFocused } }) - const recorder = await renderPaneWithConflict() - const errorNode = screen.getByText(/conflicts with/) - - // Window/app switch: the recorder blurs but gets focus back on return, so it keeps listening. - act(() => recorder.blur()) - expect(recorder.getAttribute('aria-pressed')).toBe('true') - - fireEvent.click(document.body) - - expect(recorder.getAttribute('aria-pressed')).toBe('false') - expect(setShortcutRecorderFocused).toHaveBeenLastCalledWith(false) - expect(errorNode.isConnected).toBe(true) - expect(screen.queryByText('Press another shortcut, or Esc to cancel.')).toBeNull() -}) - -it('clears a click-away error when another recorder starts', async () => { - vi.stubGlobal('api', { ui: { setShortcutRecorderFocused: vi.fn() } }) - const first = await renderPaneWithConflict() - const second = screen.getByRole('button', { name: 'Change shortcut for Clear active pane' }) - - act(() => second.focus()) - expect(first.getAttribute('aria-pressed')).toBe('true') - - fireEvent.click(second) - expect(first.getAttribute('aria-pressed')).toBe('false') - expect(second.getAttribute('aria-pressed')).toBe('true') - expect(screen.queryByText(/conflicts with/)).toBeNull() - - // A second click on the active recorder must not cancel it. - fireEvent.click(second) - expect(second.getAttribute('aria-pressed')).toBe('true') -}) diff --git a/src/renderer/src/components/tab-bar/use-sortable-tab-context-menu.test.ts b/src/renderer/src/components/tab-bar/use-sortable-tab-context-menu.test.ts deleted file mode 100644 index 3fba9e203db..00000000000 --- a/src/renderer/src/components/tab-bar/use-sortable-tab-context-menu.test.ts +++ /dev/null @@ -1,34 +0,0 @@ -// @vitest-environment happy-dom -import { act, renderHook } from '@testing-library/react' -import { expect, it } from 'vitest' -import { useSortableTabContextMenu } from './use-sortable-tab-context-menu' - -it('an old completion cannot close a reopened menu, including retained closing content', () => { - const { result } = renderHook(useSortableTabContextMenu) - act(() => result.current.onOpenChange(true)) - const oldComplete = result.current.onComplete - const oldId = result.current.openingId - act(() => result.current.onOpenChange(false)) - act(() => result.current.onOpenChange(true)) - expect(result.current.openingId).not.toBe(oldId) - act(oldComplete) - expect(result.current.open).toBe(true) - act(result.current.onComplete) - expect(result.current.open).toBe(false) -}) - -it('retires same-open completion and cannot affect a remounted owner', () => { - const first = renderHook(useSortableTabContextMenu) - act(() => first.result.current.onOpenChange(true)) - const oldComplete = first.result.current.onComplete - act(() => first.result.current.onOpenChange(true)) - act(oldComplete) - expect(first.result.current.open).toBe(true) - const unmountedComplete = first.result.current.onComplete - first.unmount() - const next = renderHook(useSortableTabContextMenu) - act(() => next.result.current.onOpenChange(true)) - act(unmountedComplete) - expect(next.result.current.open).toBe(true) - next.unmount() -}) diff --git a/src/renderer/src/components/terminal-search-safe-find.test.ts b/src/renderer/src/components/terminal-search-safe-find.test.ts deleted file mode 100644 index c6a5171b9de..00000000000 --- a/src/renderer/src/components/terminal-search-safe-find.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import { safeFind } from './terminal-search-safe-find' - -/** A viewport narrower than a stored match makes addon decoration width negative and throws from registerDecoration (crash 0b9ab636). safeFind must contain that failure without killing the terminal surface. */ - -// Match xterm’s exact synchronous negative-decoration-width error. -const positiveIntegerError = (): Error => new Error('This API only accepts positive integers') - -describe('safeFind (TerminalSearch decoration crash guard)', () => { - it('swallows the xterm "positive integers" decoration error instead of letting it crash the surface', () => { - const find = vi.fn(() => { - throw positiveIntegerError() - }) - // Contain decoration failure as no match this frame instead of tripping the terminal error boundary. - expect(() => safeFind(find, 'query')).not.toThrow() - expect(safeFind(find, 'query')).toBe(false) - expect(find).toHaveBeenCalledWith('query', undefined) - }) - - it('re-throws unrelated errors so genuine bugs are not hidden', () => { - const find = vi.fn(() => { - throw new TypeError('something genuinely broken') - }) - expect(() => safeFind(find, 'q')).toThrow('something genuinely broken') - }) -}) diff --git a/src/renderer/src/lib/agent-session/messaging/agent-send-title-status.test.ts b/src/renderer/src/lib/agent-session/messaging/agent-send-title-status.test.ts deleted file mode 100644 index b680e92644f..00000000000 --- a/src/renderer/src/lib/agent-session/messaging/agent-send-title-status.test.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { detectAgentSendTitleStatus } from './agent-send-title-status' - -describe('detectAgentSendTitleStatus', () => { - it('reads an Orca-launched Pi or OMP pane at rest as ready', () => { - // Orca shows owned panes' `π - orca` / `π > orca` titles with the agent's own brand. - expect(detectAgentSendTitleStatus('Pi - orca')).toBe('idle') - expect(detectAgentSendTitleStatus('OMP > orca')).toBe('idle') - }) -}) diff --git a/src/renderer/src/lib/clipboard/images/image-blob-png.test.ts b/src/renderer/src/lib/clipboard/images/image-blob-png.test.ts deleted file mode 100644 index bbb80cd23ad..00000000000 --- a/src/renderer/src/lib/clipboard/images/image-blob-png.test.ts +++ /dev/null @@ -1,29 +0,0 @@ -// @vitest-environment happy-dom -import { afterEach, expect, it, vi } from 'vitest' -import { blobToBase64 } from './image-blob-png' - -afterEach(() => vi.unstubAllGlobals()) - -it('aborts an active image read and settles both active and already-retired reads', async () => { - const abort = vi.fn() - vi.stubGlobal( - 'FileReader', - class { - onabort: (() => void) | null = null - readAsDataURL() {} - abort() { - abort() - this.onabort?.() - } - } - ) - const controller = new AbortController() - const pending = blobToBase64(new Blob(['image']), controller.signal) - const rejected = expect(pending).rejects.toMatchObject({ name: 'AbortError' }) - controller.abort() - await rejected - expect(abort).toHaveBeenCalledOnce() - await expect(blobToBase64(new Blob(['next']), controller.signal)).rejects.toMatchObject({ - name: 'AbortError' - }) -}) diff --git a/src/shared/github/projects/project-roadmap-timeline.test.ts b/src/shared/github/projects/project-roadmap-timeline.test.ts deleted file mode 100644 index fdcd05c81a2..00000000000 --- a/src/shared/github/projects/project-roadmap-timeline.test.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { buildRoadmapTicks, parseRoadmapDate, type RoadmapSpan } from './project-roadmap-timeline' - -const utc = (iso: string): number => Date.parse(`${iso}T00:00:00Z`) - -describe('parseRoadmapDate', () => { - it('rejects invalid calendar dates instead of letting Date.UTC normalize them', () => { - expect(parseRoadmapDate('2026-02-30')).toBeNull() - expect(parseRoadmapDate('2026-13-01')).toBeNull() - expect(parseRoadmapDate('2026-04-31')).toBeNull() - expect(parseRoadmapDate('2024-02-29')).toBe(Date.parse('2024-02-29T00:00:00Z')) - }) -}) - -describe('buildRoadmapTicks', () => { - const span = (from: string, to: string): RoadmapSpan => ({ - startMs: utc(from), - endMs: utc(to), - point: false - }) - - it('caps the grid instead of expanding for a far-future date, keeping today visible', () => { - const today = utc('2026-03-15') - const ticks = buildRoadmapTicks([span('2026-03-02', '9999-01-01')], 'month', today) - expect(ticks).toHaveLength(480) - expect(ticks[0]!.startMs).toBeLessThanOrEqual(today) - expect(ticks.at(-1)!.endMs).toBeGreaterThan(today) - }) - - it('caps the grid for a far-past date without pushing today off the edge', () => { - const today = utc('2026-03-15') - const ticks = buildRoadmapTicks([span('0206-03-02', '0206-03-10')], 'month', today) - expect(ticks).toHaveLength(480) - expect(ticks[0]!.startMs).toBeLessThanOrEqual(today) - expect(ticks.at(-1)!.endMs).toBeGreaterThan(today) - // One month of trailing padding after today survives the trim. - expect(ticks.at(-1)!.endMs).toBe(utc('2026-05-01')) - }) -}) diff --git a/src/shared/native-chat/tools/native-chat-tool-activity.spec.ts b/src/shared/native-chat/tools/native-chat-tool-activity.spec.ts deleted file mode 100644 index b9cbbda2a3a..00000000000 --- a/src/shared/native-chat/tools/native-chat-tool-activity.spec.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { describe, expect, it } from 'vitest' -import type { NativeChatBlock } from '../native-chat-types' -import { selectActiveToolCall } from './native-chat-tool-activity' - -function call( - name: string, - input: unknown, - state?: 'running' | 'completed' | 'failed' -): Extract { - return { type: 'tool-call', name, input, ...(state ? { state } : {}) } as Extract< - NativeChatBlock, - { type: 'tool-call' } - > -} - -describe('selectActiveToolCall', () => { - it('returns nothing once the turn is known to have ended', () => { - const blocks = [call('Bash', { command: 'x' }, 'running')] - expect(selectActiveToolCall(blocks, { activeTurnIsWorking: false })).toBeNull() - }) - - it('ignores settled calls even while the turn works', () => { - const blocks = [call('Read', { file_path: 'a' }, 'completed')] - expect(selectActiveToolCall(blocks, { activeTurnIsWorking: true })).toBeNull() - }) - - it('treats a lifecycle-less call as running only while the turn works', () => { - const blocks = [call('Read', { file_path: 'a' })] - expect(selectActiveToolCall(blocks, { activeTurnIsWorking: true })?.name).toBe('Read') - expect(selectActiveToolCall(blocks, { activeTurnIsWorking: undefined })).toBeNull() - }) - - it('still surfaces an explicitly running call when the turn state is unknown', () => { - const blocks = [call('Bash', { command: 'x' }, 'running')] - expect(selectActiveToolCall(blocks, { activeTurnIsWorking: undefined })?.name).toBe('Bash') - }) -}) diff --git a/src/shared/native-chat/transcript/native-chat-transcript-contracts.test.ts b/src/shared/native-chat/transcript/native-chat-transcript-contracts.test.ts index ee9c38ac319..503f24f97e5 100644 --- a/src/shared/native-chat/transcript/native-chat-transcript-contracts.test.ts +++ b/src/shared/native-chat/transcript/native-chat-transcript-contracts.test.ts @@ -1,5 +1,4 @@ import '../native-chat-reasoning-order.spec' -import '../tools/native-chat-tool-activity.spec' import '../tools/native-chat-tool-pair-limit.spec' import '../tools/native-chat-tool-fold-attribution.spec' import '../tools/native-chat-tool-pairing.spec' diff --git a/src/shared/work-items/task-source-context.test.ts b/src/shared/work-items/task-source-context.test.ts deleted file mode 100644 index 1780a8f1b96..00000000000 --- a/src/shared/work-items/task-source-context.test.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { describe, expect, it } from 'vitest' - -import { areTaskSourceContextsEqual, type TaskSourceContext } from './task-source-context' - -describe('areTaskSourceContextsEqual', () => { - const base: TaskSourceContext = { - kind: 'task-source', - provider: 'jira', - projectId: 'project-1', - hostId: 'local', - repoId: 'repo-1', - providerIdentity: { - provider: 'jira', - siteId: 'site-1', - siteUrl: 'https://company.atlassian.net', - projectKey: 'ORCA' - } - } - - it('ignores key order and absent-vs-null optional fields', () => { - expect( - areTaskSourceContextsEqual(base, { - providerIdentity: { - projectKey: 'ORCA', - siteUrl: 'https://company.atlassian.net', - siteId: 'site-1', - provider: 'jira' - }, - repoId: 'repo-1', - hostId: 'local', - projectId: 'project-1', - provider: 'jira', - kind: 'task-source', - accountLabel: null - }) - ).toBe(true) - }) - - it('separates contexts that differ by host, account, or provider identity', () => { - expect(areTaskSourceContextsEqual(base, { ...base, hostId: 'ssh:builder' })).toBe(false) - expect(areTaskSourceContextsEqual(base, { ...base, accountLabel: 'ada@example.com' })).toBe( - false - ) - expect( - areTaskSourceContextsEqual(base, { - ...base, - providerIdentity: { provider: 'jira', siteId: 'site-2' } - }) - ).toBe(false) - expect(areTaskSourceContextsEqual(base, { ...base, providerIdentity: null })).toBe(false) - }) -}) diff --git a/src/shared/work-items/work-item-empty-page.test.ts b/src/shared/work-items/work-item-empty-page.test.ts deleted file mode 100644 index eb55673de74..00000000000 --- a/src/shared/work-items/work-item-empty-page.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { resolveEmptyPageOutcome } from './work-item-empty-page' - -describe('resolveEmptyPageOutcome', () => { - const base = { failedCount: 0, errorTypes: [] as const, countedTotalPages: null } - - it('resolves as load-failed when a window 422 coincides with a sibling failure', () => { - // A sibling failure says nothing about healthy repos’ remaining pages and must outrank a window clamp. - expect( - resolveEmptyPageOutcome({ - ...base, - target: 5, - failedCount: 1, - errorTypes: ['validation_error'] - }) - ).toEqual({ reason: 'load-failed', clampTotalPagesTo: null }) - expect( - resolveEmptyPageOutcome({ - ...base, - target: 5, - errorTypes: ['validation_error', 'permission_denied'] - }) - ).toEqual({ reason: 'load-failed', clampTotalPagesTo: null }) - }) - - it('withdraws the speculative page on clean empty only while the count is unknown', () => { - expect(resolveEmptyPageOutcome({ ...base, target: 2 })).toEqual({ - reason: 'end-of-data', - clampTotalPagesTo: 2 - }) - expect(resolveEmptyPageOutcome({ ...base, target: 2, countedTotalPages: 0 })).toEqual({ - reason: 'end-of-data', - clampTotalPagesTo: 2 - }) - // PR failures can become clean-empty results; shrinking a real count would silently hide healthy pages. - expect(resolveEmptyPageOutcome({ ...base, target: 2, countedTotalPages: 34 })).toEqual({ - reason: 'end-of-data', - clampTotalPagesTo: null - }) - expect(resolveEmptyPageOutcome({ ...base, target: 0 })).toEqual({ - reason: 'end-of-data', - clampTotalPagesTo: 1 - }) - }) -})