Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

test: remove 28 low-value test suites (#36226)

OrcaWin8aac9c125475
diff --git a/config/scripts/ci-shard-timings.json b/config/scripts/ci-shard-timings.json
index 7a4ac0e2789..4922563f1c9 100644
--- a/config/scripts/ci-shard-timings.json
+++ b/config/scripts/ci-shard-timings.json
@@ -2284,7 +2284,6 @@
"src/main/daemon/terminal-host-process-inspection-cheap-tier.test.ts": 669,
"src/main/daemon/terminal-host-process-inspection.test.ts": 287,
"src/main/daemon/terminal-host-pty-owner-backend.test.ts": 738,
- "src/main/daemon/terminal-host-readiness-reporting.test.ts": 331,
"src/main/daemon/terminal-host-session-reaping-leak.test.ts": 486,
"src/main/daemon/terminal-host-spawn-input-retention.test.ts": 701,
"src/main/daemon/terminal-host-startup-staging.test.ts": 444,
@@ -2446,7 +2445,6 @@
"src/main/git/porcelain-v1-records.test.ts": 162,
"src/main/git/remote-name-listing.test.ts": 525,
"src/main/git/remote-ref-probe-cache.test.ts": 274,
- "src/main/git/remote-url-probe.test.ts": 313,
"src/main/git/remote.test.ts": 380,
"src/main/git/remove-worktree-branch-cleanup.test.ts": 327,
"src/main/git/remove-worktree-clean-preflight.test.ts": 175,
@@ -4477,7 +4475,6 @@
"src/main/plugins/plugin-service-housekeeping.test.ts": 29,
"src/main/plugins/plugin-service-integrity.test.ts": 292,
"src/main/plugins/plugin-service-reconciliation.test.ts": 1419,
- "src/main/plugins/plugin-startup-budget.test.ts": 663,
"src/main/plugins/plugin-storage-store.test.ts": 158,
"src/main/plugins/plugin-uninstall-lifecycle.test.ts": 873,
"src/main/plugins/plugin-uninstall-log-retention.test.ts": 886,
@@ -5317,7 +5314,6 @@
"src/main/runtime/rpc/methods/client-native-chat-settings.test.ts": 631,
"src/main/runtime/rpc/methods/client-ui-pairing-local-fields.test.ts": 757,
"src/main/runtime/rpc/methods/client-ui-set-collapsed.test.ts": 625,
- "src/main/runtime/rpc/methods/client-ui-task-resume-state.test.ts": 492,
"src/main/runtime/rpc/methods/client-ui.test.ts": 633,
"src/main/runtime/rpc/methods/clipboard-image-upload-decoding.test.ts": 526,
"src/main/runtime/rpc/methods/clipboard.test.ts": 449,
@@ -5464,7 +5460,6 @@
"src/main/runtime/rpc/methods/session-tab-browser-placement-projection.test.ts": 123,
"src/main/runtime/rpc/methods/session-tab-file-host-projection.test.ts": 761,
"src/main/runtime/rpc/methods/session-tab-registered-agent-projection.test.ts": 920,
- "src/main/runtime/rpc/methods/session-tabs-create-terminal-shell.test.ts": 1253,
"src/main/runtime/rpc/methods/session-tabs-inventory-census-race.test.ts": 2885,
"src/main/runtime/rpc/methods/session-tabs-inventory-rpc.test.ts": 2517,
"src/main/runtime/rpc/methods/session-tabs-move-validation.test.ts": 2914,
@@ -5527,7 +5522,6 @@
"src/main/runtime/rpc/methods/terminal-reveal.test.ts": 1159,
"src/main/runtime/rpc/methods/terminal-stream-extraction-characterization.test.ts": 61,
"src/main/runtime/rpc/methods/terminal/headless-copy-desktop-depth.test.ts": 72,
- "src/main/runtime/rpc/methods/terminal/terminal-create-sort-stamp.test.ts": 509,
"src/main/runtime/rpc/methods/terminal/terminal-input-sequence-ledger.test.ts": 61,
"src/main/runtime/rpc/methods/terminal/terminal-inspect-process-params.test.ts": 195,
"src/main/runtime/rpc/methods/terminal/terminal-snapshot-json-byte-budget.test.ts": 182,
@@ -5672,7 +5666,6 @@
"src/main/runtime/runtime-client-settings-projections.test.ts": 506,
"src/main/runtime/runtime-created-worktree-terminal-target.test.ts": 3660,
"src/main/runtime/runtime-desktop-pane-title-forwarding.test.ts": 4418,
- "src/main/runtime/runtime-extraction-regressions.test.ts": 2857,
"src/main/runtime/runtime-failed-local-worktree-removal.test.ts": 1120,
"src/main/runtime/runtime-file-listing-producer-budgets.test.ts": 517,
"src/main/runtime/runtime-file-target-execution-host.test.ts": 2021,
@@ -5708,7 +5701,6 @@
"src/main/runtime/runtime-local-create-rearm-ordering.test.ts": 3031,
"src/main/runtime/runtime-local-worktree-create.test.ts": 575,
"src/main/runtime/runtime-local-worktree-materialization.test.ts": 152,
- "src/main/runtime/runtime-local-worktree-setup.test.ts": 615,
"src/main/runtime/runtime-local-worktree-terminal-startup-layout-owner.test.ts": 51,
"src/main/runtime/runtime-local-worktree-terminal-startup.test.ts": 71,
"src/main/runtime/runtime-machine-name.test.ts": 62,
@@ -6184,10 +6176,7 @@
"src/main/skills/skill-process-contention.integration.test.ts": 92,
"src/main/skills/skill-process-termination-child.test.ts": 176,
"src/main/skills/skill-process-termination.integration.test.ts": 175,
- "src/main/skills/skill-provider-destinations.test.ts": 53,
- "src/main/skills/skill-provider-discovery-coverage.test.ts": 86,
"src/main/skills/skill-provider-runtime-roots.test.ts": 45,
- "src/main/skills/skill-remote-error-category-parity.test.ts": 163,
"src/main/skills/skill-remote-install-cancellation.test.ts": 36,
"src/main/skills/skill-remote-install-service.test.ts": 120,
"src/main/skills/skill-remove-transaction.test.ts": 439,
@@ -6466,7 +6455,6 @@
"src/main/star-nag/service-threshold-prompt.test.ts": 141,
"src/main/startup/bootstrap-fatal-exit-guard.test.ts": 31,
"src/main/startup/branch-rename-hook-structured-session.test.ts": 286,
- "src/main/startup/branch-rename-hook-subscription.test.ts": 38,
"src/main/startup/browser-process-user-agent-ordering.test.ts": 1895,
"src/main/startup/cli-launch-redirect.test.ts": 120,
"src/main/startup/cloud-session-shutdown-flush.test.ts": 77,
@@ -6494,7 +6482,6 @@
"src/main/startup/linux-keyring-backend-selection.test.ts": 39,
"src/main/startup/linux-secret-service-probe.test.ts": 41,
"src/main/startup/login-shell-environment-cache.test.ts": 111,
- "src/main/startup/login-shell-environment-git-bash.test.ts": 35,
"src/main/startup/login-shell-environment.test.ts": 80,
"src/main/startup/main-process-error-guards.test.ts": 73,
"src/main/startup/main-process-observers-hang-breadcrumb.test.ts": 158,
@@ -8322,7 +8309,6 @@
"src/renderer/src/components/right-sidebar/FileExplorerFilesTreePane.errors.test.tsx": 3001,
"src/renderer/src/components/right-sidebar/FileExplorerQueryStrip.focus.test.tsx": 530,
"src/renderer/src/components/right-sidebar/FileExplorerRow.actions.test.tsx": 287,
- "src/renderer/src/components/right-sidebar/FileExplorerScopeNotice.test.tsx": 480,
"src/renderer/src/components/right-sidebar/FileExplorerToolbar.test.tsx": 1475,
"src/renderer/src/components/right-sidebar/FileExplorerVirtualRows.row-handlers.test.tsx": 2029,
"src/renderer/src/components/right-sidebar/FileExplorerVirtualRowsAddProject.test.tsx": 1985,
@@ -8507,7 +8493,6 @@
"src/renderer/src/components/right-sidebar/source-control-hosted-review-creation-eligibility-snapshot.test.ts": 87,
"src/renderer/src/components/right-sidebar/source-control-hosted-review-push-target.test.ts": 52,
"src/renderer/src/components/right-sidebar/source-control-huge-repo-warning-dismissals.test.ts": 150,
- "src/renderer/src/components/right-sidebar/source-control-launch-agent-args-applicability.test.ts": 403,
"src/renderer/src/components/right-sidebar/source-control-manual-review-url.test.ts": 49,
"src/renderer/src/components/right-sidebar/source-control-primary-action-tooltip.test.ts": 123,
"src/renderer/src/components/right-sidebar/source-control-primary-action.create-pr-intent.test.ts": 204,
@@ -9249,7 +9234,6 @@
"src/renderer/src/components/status-bar/resource-session-bindings.test.ts": 75,
"src/renderer/src/components/status-bar/resource-session-inventory.test.ts": 93,
"src/renderer/src/components/status-bar/resource-session-kill-confirmation.test.ts": 42,
- "src/renderer/src/components/status-bar/resource-session-navigation.test.ts": 49,
"src/renderer/src/components/status-bar/resource-session-removal-render-budget.test.tsx": 288,
"src/renderer/src/components/status-bar/resource-usage-folder-merge.test.ts": 87,
"src/renderer/src/components/status-bar/resource-usage-open-slices.test.ts": 1804,
@@ -9408,7 +9392,6 @@
"src/renderer/src/components/task-page-jira-favourite-catalogue.test.tsx": 2450,
"src/renderer/src/components/task-page-jira-favourite-selection.test.tsx": 3325,
"src/renderer/src/components/task-page-jira-grouping.test.ts": 1486,
- "src/renderer/src/components/task-page/jira/task-page-jira-item-source-context.test.ts": 31,
"src/renderer/src/components/task-page/jira/task-page-jira-linked-issues.test.ts": 54,
"src/renderer/src/components/task-page/jira/task-page-jira-load-state.test.ts": 48,
"src/renderer/src/components/task-page/jira/task-page-jira-project-selection.test.ts": 28,
@@ -9974,7 +9957,6 @@
"src/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.test.ts": 50,
"src/renderer/src/components/terminal-pane/terminal-snapshot-replay-paint.test.ts": 548,
"src/renderer/src/components/terminal-pane/terminal-spawn-error-display.test.ts": 45,
- "src/renderer/src/components/terminal-pane/terminal-ssh-sign-in-error.test.ts": 341,
"src/renderer/src/components/terminal-pane/terminal-startup-command-classifier.test.ts": 79,
"src/renderer/src/components/terminal-pane/terminal-startup-timing-scheduler.test.ts": 98,
"src/renderer/src/components/terminal-pane/terminal-startup-timing.test.ts": 38,
@@ -11521,7 +11503,6 @@
"src/renderer/src/store/slices/github-cache-eviction-host-scopes.test.ts": 293,
"src/renderer/src/store/slices/github-checks-cache.test.ts": 369,
"src/renderer/src/store/slices/github-checks.test.ts": 51,
- "src/renderer/src/store/slices/github-issue-source-indicator-suppression.test.ts": 640,
"src/renderer/src/store/slices/github-issue-state-machine.test.ts": 330,
"src/renderer/src/store/slices/github-pr-branch-coordinator-events.test.ts": 703,
"src/renderer/src/store/slices/github-pr-branch-direct-refresh-scope.test.ts": 782,
diff --git a/src/cli/specs/remote-selection-help.test.ts b/src/cli/specs/remote-selection-help.test.ts
deleted file mode 100644
index 171f90c5e14..00000000000
--- a/src/cli/specs/remote-selection-help.test.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import { formatCommandHelp } from '../help'
-import { ignoresRemoteSelection } from '../remote-selection-scope'
-import { COMMAND_SPECS } from './index'
-
-const REMOTE_SELECTORS = ['environment', 'pairing-code']
-
-function optionFlags(help: string): string[] {
- const options = help.split('\n\nOptions:\n')[1]?.split('\n\n')[0] ?? ''
- return options.split('\n').map((line) => line.trim().split(/\s/)[0] ?? '')
-}
-
-describe('remote selectors in command help', () => {
- // Dispatch ignores remote selection for these commands, so help may name a selector only as the command's own argument.
- it.each(COMMAND_SPECS.filter((spec) => ignoresRemoteSelection(spec.path)))(
- 'offers no remote selector it ignores for $path',
- (spec) => {
- const offered = optionFlags(formatCommandHelp(spec))
- for (const flag of REMOTE_SELECTORS) {
- if (!spec.usage.includes(`--${flag} `)) {
- expect(offered).not.toContain(`--${flag}`)
- }
- }
- }
- )
-
- it('keeps a selector the command takes as its own argument', () => {
- const show = COMMAND_SPECS.find((spec) => spec.path.join(' ') === 'environment show')
- expect(optionFlags(show ? formatCommandHelp(show) : '')).toContain('--environment')
- })
-})
diff --git a/src/main/daemon/pty-subprocess-wsl-cwd-report.test.ts b/src/main/daemon/pty-subprocess-wsl-cwd-report.test.ts
deleted file mode 100644
index bb66e542e4f..00000000000
--- a/src/main/daemon/pty-subprocess-wsl-cwd-report.test.ts
+++ /dev/null
@@ -1,73 +0,0 @@
-import { describe, expect, it, vi } from 'vitest'
-import { readFileSync } from 'node:fs'
-import { join } from 'node:path'
-import type * as LocalPtyUtils from '../providers/local-pty-utils'
-
-const {
- spawnMock,
- isPwshAvailableMock,
- validateWorkingDirectoryMock,
- resolveUnixShellPathMock,
- resolveAgentForegroundProcessMock
-} = vi.hoisted(() => ({
- spawnMock: vi.fn(),
- isPwshAvailableMock: vi.fn(),
- resolveUnixShellPathMock: vi.fn((shellPath: string) => shellPath),
- resolveAgentForegroundProcessMock: vi.fn(),
- validateWorkingDirectoryMock: vi.fn()
-}))
-
-vi.mock('node-pty', () => ({ spawn: spawnMock }))
-vi.mock('../pwsh', () => ({ isPwshAvailable: isPwshAvailableMock }))
-vi.mock('../providers/local-pty-utils', async (importOriginal) => ({
- ...(await importOriginal<typeof LocalPtyUtils>()),
- resolveUnixShellPath: resolveUnixShellPathMock,
- validateWorkingDirectory: validateWorkingDirectoryMock,
- validateWorkingDirectoryAsync: validateWorkingDirectoryMock
-}))
-vi.mock('../providers/windows-pty-job-membership', () => ({
- readWindowsPtyJobProcessIds: () => new Set([12345]),
- isWindowsPtyJobReadable: () => true
-}))
-
-import { createPtySubprocess } from './pty-subprocess'
-import { mockPtyProcess, useDaemonPtySubprocessEnv } from './pty-subprocess-test-harness'
-
-// The daemon's bridge spawn must point the guest at the wrappers that carry the folder report,
-// not the daemon's own Unix fileset (daemon-shell-ready-wrapper-fileset.ts).
-describe('a daemon-spawned WSL bridge pane', () => {
- useDaemonPtySubprocessEnv({
- spawnMock,
- isPwshAvailableMock,
- resolveUnixShellPathMock,
- resolveAgentForegroundProcessMock,
- validateWorkingDirectoryMock
- })
-
- it('sources wrappers that report its folder', async () => {
- spawnMock.mockReturnValue(mockPtyProcess())
- const platform = Object.getOwnPropertyDescriptor(process, 'platform')
- Object.defineProperty(process, 'platform', { value: 'win32' })
- try {
- await createPtySubprocess({
- sessionId: 'test',
- cols: 80,
- rows: 24,
- cwd: '\\\\wsl.localhost\\Ubuntu\\home\\jin\\repo'
- })
- } finally {
- if (platform) {
- Object.defineProperty(process, 'platform', platform)
- }
- }
-
- const [file, args, options] = spawnMock.mock.calls.at(-1)!
- expect(file).toBe('wsl.exe')
- expect(args.at(-1)).toContain('"${_orca_shell_ready_root}/bash/rcfile"')
- expect(args.at(-1)).toContain('ZDOTDIR="${_orca_shell_ready_root}/zsh"')
- const root: string = options.env.ORCA_SHELL_READY_ROOT
- expect(options.env.WSLENV.split(':')).toContain('ORCA_SHELL_READY_ROOT/p')
- expect(readFileSync(join(root, 'bash', 'rcfile'), 'utf8')).toContain('__orca_wsl_cwd_report')
- expect(readFileSync(join(root, 'zsh', '.zshenv'), 'utf8')).toContain('__orca_wsl_cwd_report')
- })
-})
diff --git a/src/main/daemon/terminal-host-readiness-reporting.test.ts b/src/main/daemon/terminal-host-readiness-reporting.test.ts
deleted file mode 100644
index 6d944f9ff0f..00000000000
--- a/src/main/daemon/terminal-host-readiness-reporting.test.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import './mock-descendant-sweep'
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-import type { SubprocessHandle } from './session-subprocess-handle'
-import { TerminalHost } from './terminal-host'
-
-/** Verify the diagnostic sink reaches the host: detached daemon console output is discarded. */
-function createSubprocess(): SubprocessHandle & { exit: () => void } {
- let onExit: ((code: number) => void) | null = null
- return {
- pid: 4242,
- shellPath: '/opt/homebrew/bin/zsh',
- getForegroundProcess: () => 'zsh',
- write: vi.fn(),
- resize: vi.fn(),
- kill: vi.fn(),
- terminateOwnedTree: () => 'unavailable' as const,
- forceKill: vi.fn(),
- signal: vi.fn(),
- onData: () => {},
- onExit: (listener) => {
- onExit = listener
- },
- dispose: vi.fn(),
- exit: () => onExit?.(0)
- } as SubprocessHandle & { exit: () => void }
-}
-
-describe('TerminalHost readiness reporting', () => {
- let host: TerminalHost
- let subprocess: ReturnType<typeof createSubprocess> | undefined
- const events: { event: string; details: Record<string, unknown> }[] = []
- const spawnSubprocess = vi.fn(() => {
- subprocess = createSubprocess()
- return subprocess
- })
-
- beforeEach(() => {
- vi.useFakeTimers()
- events.length = 0
- spawnSubprocess.mockClear()
- host = new TerminalHost({
- spawnSubprocess,
- reportReadinessEvent: (event, details) => events.push({ event, details })
- })
- })
-
- afterEach(async () => {
- subprocess?.exit()
- await host.dispose()
- vi.useRealTimers()
- })
-
- it('delivers a shell-ready timeout out to the daemon log sink', async () => {
- await host.createOrAttach({
- sessionId: 'session-readiness',
- cols: 80,
- rows: 24,
- streamClient: { onData: vi.fn(), onExit: vi.fn() },
- shellReadySupported: true
- })
-
- vi.advanceTimersByTime(15_000)
-
- expect(events.map((entry) => entry.event)).toContain('shell-ready-timeout')
- const timeout = events.find((entry) => entry.event === 'shell-ready-timeout')
- expect(timeout?.details).toMatchObject({ sessionId: 'session-readiness', timeoutMs: 15_000 })
- // Shell paths may contain home directories; diagnostics retain only the basename.
- expect(timeout?.details.shell).toBe('zsh')
- })
-})
diff --git a/src/main/git/command-runner/git-exec-file-sync.test.ts b/src/main/git/command-runner/git-exec-file-sync.test.ts
deleted file mode 100644
index 2974f3e477e..00000000000
--- a/src/main/git/command-runner/git-exec-file-sync.test.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-import type * as ChildProcess from 'node:child_process'
-import { afterEach, describe, expect, it, vi } from 'vitest'
-
-const { execFileSync } = vi.hoisted(() => ({
- execFileSync: vi.fn((_binary: string, _args: readonly string[], _options?: unknown) => 'out')
-}))
-vi.mock('node:child_process', async (importOriginal) => ({
- ...(await importOriginal<typeof ChildProcess>()),
- execFileSync
-}))
-
-import { gitExecFileSync } from './git-exec-file-sync'
-import { untranslatedGitOutputEnv } from './git-process-env'
-import { setLocalGitRuntimeRouter } from './local-git-runtime-route'
-
-const originalPlatform = process.platform
-
-afterEach(() => {
- execFileSync.mockClear()
- setLocalGitRuntimeRouter(null)
- Object.defineProperty(process, 'platform', { configurable: true, value: originalPlatform })
-})
-
-describe('gitExecFileSync', () => {
- it('runs host Git even in a WSL project, so the main thread never waits on wsl.exe', () => {
- Object.defineProperty(process, 'platform', { configurable: true, value: 'win32' })
- setLocalGitRuntimeRouter(() => 'Ubuntu')
- gitExecFileSync(['rev-parse', '--git-path', 'hooks'], {
- cwd: String.raw`C:\src\app`,
- hostGit: true
- })
- const [binary] = execFileSync.mock.calls[0] ?? ['']
- expect(binary.toLowerCase()).not.toContain('wsl')
- })
-
- it('spawns exactly what it did before hostGit existed on POSIX', () => {
- Object.defineProperty(process, 'platform', { configurable: true, value: 'linux' })
- gitExecFileSync(['rev-parse', '--git-path', 'orca/setup-runner.sh'], {
- cwd: '/test/worktree',
- hostGit: true
- })
- expect(execFileSync.mock.calls).toEqual([
- [
- 'git',
- ['rev-parse', '--git-path', 'orca/setup-runner.sh'],
- {
- cwd: '/test/worktree',
- encoding: 'utf-8',
- env: untranslatedGitOutputEnv(),
- stdio: ['pipe', 'pipe', 'pipe'],
- timeout: 15_000,
- windowsHide: true
- }
- ]
- ])
- })
-})
diff --git a/src/main/git/remote-url-probe.test.ts b/src/main/git/remote-url-probe.test.ts
deleted file mode 100644
index feb4ed4b1fd..00000000000
--- a/src/main/git/remote-url-probe.test.ts
+++ /dev/null
@@ -1,71 +0,0 @@
-import { beforeEach, describe, expect, it, vi } from 'vitest'
-
-const { gitExecFileAsyncMock } = vi.hoisted(() => ({
- gitExecFileAsyncMock: vi.fn()
-}))
-
-vi.mock('./runner', () => ({ gitExecFileAsync: gitExecFileAsyncMock }))
-
-import { SshHostNotServedError } from '../providers/ssh-host-not-served-error'
-import {
- assertRemoteUrlReadable,
- isTransientGitProbeError,
- readRemoteUrl,
- REMOTE_URL_PROBE_TIMEOUT_MS
-} from './remote-url-probe'
-
-describe('remote URL probe', () => {
- beforeEach(() => {
- gitExecFileAsyncMock.mockReset()
- })
-
- it('bounds local and WSL remote reads with the shared timeout', async () => {
- gitExecFileAsyncMock.mockResolvedValue({ stdout: '[email protected]:acme/orca.git\n' })
-
- await expect(
- readRemoteUrl({ repoPath: '/repo', wslDistro: 'Ubuntu' }, 'upstream')
- ).resolves.toContain('github.com')
-
- expect(gitExecFileAsyncMock).toHaveBeenCalledWith(['remote', 'get-url', 'upstream'], {
- cwd: '/repo',
- timeout: REMOTE_URL_PROBE_TIMEOUT_MS,
- wslDistro: 'Ubuntu'
- })
-
- await expect(readRemoteUrl({ repoPath: '/repo' }, 'origin')).resolves.toContain('github.com')
-
- expect(gitExecFileAsyncMock).toHaveBeenLastCalledWith(['remote', 'get-url', 'origin'], {
- cwd: '/repo',
- timeout: REMOTE_URL_PROBE_TIMEOUT_MS
- })
- })
-
- it('reports a probe cut off by its deadline as unavailable, not as an answer', async () => {
- const aborted = new Error('Request was cancelled')
- aborted.name = 'AbortError'
- gitExecFileAsyncMock.mockRejectedValue(aborted)
-
- expect(isTransientGitProbeError(aborted)).toBe(true)
- await expect(assertRemoteUrlReadable({ repoPath: '/repo' })).rejects.toBe(aborted)
- })
-
- it('rethrows a timed-out local probe so callers can report unavailable', async () => {
- const timeout = new Error('git timed out.')
- gitExecFileAsyncMock.mockRejectedValue(timeout)
-
- expect(isTransientGitProbeError(timeout)).toBe(true)
- await expect(assertRemoteUrlReadable({ repoPath: '/repo' })).rejects.toBe(timeout)
- })
-
- it('accepts a stable missing remote as a readable, empty repository state', async () => {
- gitExecFileAsyncMock.mockRejectedValue(new Error("fatal: No such remote 'origin'"))
-
- await expect(assertRemoteUrlReadable({ repoPath: '/repo' })).resolves.toBeUndefined()
- })
-
- it('does not turn an SSH target into a false readable result', async () => {
- await expect(
- assertRemoteUrlReadable({ repoPath: '/repo', connectionId: 'ssh-1' })
- ).rejects.toThrow(SshHostNotServedError)
- })
-})
diff --git a/src/main/plugins/plugin-startup-budget.test.ts b/src/main/plugins/plugin-startup-budget.test.ts
deleted file mode 100644
index b78486dd07f..00000000000
--- a/src/main/plugins/plugin-startup-budget.test.ts
+++ /dev/null
@@ -1,135 +0,0 @@
-import { mkdir, mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'
-import { tmpdir } from 'node:os'
-import { join } from 'node:path'
-import { performance } from 'node:perf_hooks'
-import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'
-import { fingerprintPluginConsent } from '../../shared/plugins/approval/plugin-consent-fingerprint'
-import {
- PLUGIN_MANIFEST_FILENAME,
- pluginManifestSchema,
- qualifiedPluginKey,
- type PluginManifest
-} from '../../shared/plugins/manifest/plugin-manifest'
-import { PluginService } from './plugin-service'
-import type { PluginServiceOptions } from './plugin-service-options'
-import type { PluginWorkerFactory } from './workers/plugin-worker-manager'
-
-const PLUGIN_COUNT = 20
-const SAMPLE_COUNT = 20
-// Disk scheduling varies; catch large regressions while separately asserting no worker/code execution.
-const STARTUP_P95_BUDGET_MS = 400
-
-let userDataPath = ''
-let markerPaths: string[] = []
-let consents: Record<string, string> = {}
-
-function dummyManifest(index: number): PluginManifest {
- const key = String.fromCharCode('A'.charCodeAt(0) + index)
- return pluginManifestSchema.parse({
- manifestVersion: 1,
- id: `dummy-${index}`,
- publisher: 'startup-budget',
- name: `Startup Dummy ${index}`,
- version: '1.0.0',
- engines: { orca: '>=1.0.0' },
- pluginApi: 1,
- contributes: {
- panels: [],
- commands: [
- {
- id: 'open',
- title: `Open Startup Dummy ${index}`,
- action: 'view.tasks'
- }
- ],
- events: [],
- keybindings: [{ command: 'open', key: `Mod+Alt+${key}` }],
- languagePacks: [{ locale: 'pt-BR', path: 'locale.json' }]
- },
- capabilities: []
- })
-}
-
-async function installDummy(index: number): Promise<{ pluginKey: string; markerPath: string }> {
- const manifest = dummyManifest(index)
- const pluginKey = qualifiedPluginKey(manifest)
- const contentHash = (index + 1).toString(16).padStart(64, '0')
- const pluginDir = join(userDataPath, 'plugins', pluginKey)
- const versionDir = join(pluginDir, contentHash)
- const markerPath = join(userDataPath, `activation-${index}.marker`)
- await mkdir(versionDir, { recursive: true })
- await Promise.all([
- writeFile(join(pluginDir, 'current'), contentHash),
- writeFile(join(versionDir, PLUGIN_MANIFEST_FILENAME), JSON.stringify(manifest)),
- writeFile(
- join(versionDir, 'locale.json'),
- JSON.stringify({ startup: { label: `Startup Dummy ${index}` } })
- )
- ])
- consents[pluginKey] = fingerprintPluginConsent(manifest)
- return { pluginKey, markerPath }
-}
-
-function nearestRankP95(samples: readonly number[]): number {
- const sorted = [...samples].sort((left, right) => left - right)
- return sorted[Math.ceil(sorted.length * 0.95) - 1]!
-}
-
-describe('plugin startup budget', () => {
- beforeAll(async () => {
- userDataPath = await mkdtemp(join(tmpdir(), 'orca-plugin-startup-budget-'))
- const installed = await Promise.all(
- Array.from({ length: PLUGIN_COUNT }, (_, index) => installDummy(index))
- )
- markerPaths = installed.map(({ markerPath }) => markerPath)
- })
-
- afterAll(async () => {
- await rm(userDataPath, { recursive: true, force: true })
- })
-
- it('stays below 50ms P95 with 20 approved content packs and executes no plugin code', async () => {
- const workerFactory = vi.fn<PluginWorkerFactory>(async () => {
- throw new Error('startup must not create a plugin worker')
- })
- const options: PluginServiceOptions = {
- userDataPath,
- hostVersion: '1.4.0',
- isPluginSystemEnabled: () => true,
- getDisabledPlugins: () => [],
- getPluginConsents: () => consents,
- getDevPluginPaths: () => [],
- workerFactory
- }
- const measure = async (): Promise<number> => {
- const startedAt = performance.now()
- const service = new PluginService(options)
- await service.initialize()
- const elapsedMs = performance.now() - startedAt
- expect(service.getDiscovered()).toHaveLength(PLUGIN_COUNT)
- await service.dispose()
- return elapsedMs
- }
-
- await measure()
- const samples: number[] = []
- for (let index = 0; index < SAMPLE_COUNT; index += 1) {
- samples.push(await measure())
- }
-
- const p95 = nearestRankP95(samples)
- if (process.env.ORCA_PLUGIN_STARTUP_BUDGET_REPORT === '1') {
- process.stdout.write(`plugin startup P95 ${p95.toFixed(2)}ms (${SAMPLE_COUNT} samples)\n`)
- }
- expect(workerFactory).not.toHaveBeenCalled()
- await Promise.all(
- markerPaths.map((markerPath) =>
- expect(readFile(markerPath, 'utf8')).rejects.toMatchObject({ code: 'ENOENT' })
- )
- )
- expect(
- p95,
- `plugin startup P95 ${p95.toFixed(2)}ms; samples: ${samples.map((sample) => sample.toFixed(2)).join(', ')}`
- ).toBeLessThan(STARTUP_P95_BUDGET_MS)
- })
-})
diff --git a/src/main/providers/local-pty-runtime-spawn.test.ts b/src/main/providers/local-pty-runtime-spawn.test.ts
deleted file mode 100644
index 6976e5d2a61..00000000000
--- a/src/main/providers/local-pty-runtime-spawn.test.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { afterEach, describe, expect, it, vi } from 'vitest'
-
-vi.mock('node-pty', () => {
- throw new Error('node-pty native binding failed to load')
-})
-
-import { loadLocalPtyRuntimeSpawn } from './local-pty-runtime-spawn'
-import { onNodePtyLoadFailure } from './node-pty-load-failure'
-
-let unsubscribe = (): void => {}
-afterEach(() => unsubscribe())
-
-describe('loadLocalPtyRuntimeSpawn', () => {
- it('reports a node-pty load failure to listeners, then rethrows it', async () => {
- const failures = vi.fn()
- unsubscribe = onNodePtyLoadFailure(failures)
-
- await expect(loadLocalPtyRuntimeSpawn()).rejects.toThrow()
-
- expect(failures).toHaveBeenCalledOnce()
- })
-})
diff --git a/src/main/runtime/rpc/methods/client-ui-task-resume-state.test.ts b/src/main/runtime/rpc/methods/client-ui-task-resume-state.test.ts
deleted file mode 100644
index 2abed8cd599..00000000000
--- a/src/main/runtime/rpc/methods/client-ui-task-resume-state.test.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import '../unused-default-rpc-methods.test-fixture'
-import { describe, expect, it, vi } from 'vitest'
-import { getDefaultUIState } from '../../../../shared/constants'
-import type { OrcaRuntimeService } from '../../orca-runtime'
-import type { RpcRequest } from '../core'
-import { RpcDispatcher } from '../dispatcher'
-import { CLIENT_UI_METHODS } from './client-ui'
-import { TaskResumeState } from './task-resume-state-schema'
-
-function makeRequest(params: unknown): RpcRequest {
- return { id: 'req-1', authToken: 'tok', method: 'ui.set', params }
-}
-
-function makeDispatcher(): { dispatcher: RpcDispatcher; updateUIState: ReturnType<typeof vi.fn> } {
- const updateUIState = vi.fn(() => getDefaultUIState())
- const runtime = {
- getRuntimeId: () => 'test-runtime',
- updateUIState
- } as unknown as OrcaRuntimeService
- return { dispatcher: new RpcDispatcher({ runtime, methods: CLIENT_UI_METHODS }), updateUIState }
-}
-
-describe('ui.set task resume state', () => {
- it('persists the cross-client resume fields', async () => {
- const { dispatcher, updateUIState } = makeDispatcher()
- const taskResumeState = {
- githubMode: 'items' as const,
- githubItemsQuery: 'is:open',
- linearMode: 'issues' as const,
- linearQuery: 'label:bug',
- jiraPreset: 'reported' as const
- }
-
- const response = await dispatcher.dispatch(makeRequest({ taskResumeState }))
-
- expect(response).toMatchObject({ ok: true })
- expect(updateUIState).toHaveBeenCalledWith({ taskResumeState })
- })
-
- // A strict nested object behind field-level catch drops all resume state on one unknown key; keep device preferences local.
- it('drops the whole resume state when a payload carries a key the schema omits', async () => {
- const { dispatcher, updateUIState } = makeDispatcher()
-
- const response = await dispatcher.dispatch(
- makeRequest({
- sidebarWidth: 280,
- taskResumeState: { linearQuery: 'label:bug', somethingThisHostPredates: true }
- })
- )
-
- expect(response).toMatchObject({ ok: true })
- expect(updateUIState).toHaveBeenCalledWith({ sidebarWidth: 280 })
- })
-
- // Hosts predating #12710 drop all resume state on linearIssueView; keep it device-local.
- it('keeps the Linear issue view off the wire', () => {
- expect(Object.keys(TaskResumeState.shape)).not.toContain('linearIssueView')
- })
-})
diff --git a/src/main/runtime/rpc/methods/repo-source-control-ai-publication.test.ts b/src/main/runtime/rpc/methods/repo-source-control-ai-publication.test.ts
deleted file mode 100644
index 10bdbc9a7dd..00000000000
--- a/src/main/runtime/rpc/methods/repo-source-control-ai-publication.test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import '../unused-default-rpc-methods.test-fixture'
-import { describe, expect, it, vi } from 'vitest'
-import type { OrcaRuntimeService } from '../../orca-runtime'
-import { makeRequest, repoDispatcher } from './repo-rpc.test-fixture'
-
-describe('repo RPC methods', () => {
- it('preserves the canonical action document through update, list and show envelopes', async () => {
- const sourceControlAi = {
- actionOverrides: {
- fixChecks: {
- agentId: 'codex' as const,
- agentArgs: '--search',
- launchPreferences: {
- agentId: 'claude' as const,
- permissionMode: 'ask' as const,
- modelSelection: {
- base: 'inherit' as const,
- model: { agentId: 'codex' as const, value: null }
- }
- },
- argumentChoices: {
- syntaxAgent: 'codex' as const,
- nodes: [{ at: 0, text: '-c model=o3' }]
- }
- }
- }
- }
- const repo = {
- id: 'repo-1',
- path: '/repo',
- displayName: 'repo',
- badgeColor: '',
- addedAt: 0,
- sourceControlAi
- }
- const updateRepo = vi.fn<OrcaRuntimeService['updateRepo']>().mockResolvedValue(repo)
- const dispatcher = repoDispatcher({
- getRuntimeId: () => 'test-runtime',
- updateRepo,
- listVisibleRepos: () => [repo],
- showRepo: async () => repo
- })
- expect(
- await dispatcher.dispatch(
- makeRequest('repo.update', {
- repo: 'id:repo-1',
- updates: { sourceControlAi }
- })
- )
- ).toMatchObject({ ok: true, result: { repo: { sourceControlAi } } })
- expect(updateRepo).toHaveBeenCalledExactlyOnceWith('id:repo-1', { sourceControlAi })
- expect(await dispatcher.dispatch(makeRequest('repo.list'))).toMatchObject({
- ok: true,
- result: { repos: [{ sourceControlAi }] }
- })
- expect(
- await dispatcher.dispatch(makeRequest('repo.show', { repo: 'id:repo-1' }))
- ).toMatchObject({
- ok: true,
- result: { repo: { sourceControlAi } }
- })
- })
-})
diff --git a/src/main/runtime/rpc/methods/session-tabs-create-terminal-shell.test.ts b/src/main/runtime/rpc/methods/session-tabs-create-terminal-shell.test.ts
deleted file mode 100644
index af4eac0bf49..00000000000
--- a/src/main/runtime/rpc/methods/session-tabs-create-terminal-shell.test.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-import '../unused-default-rpc-methods.test-fixture'
-import { describe, expect, it, vi } from 'vitest'
-import { RpcDispatcher } from '../dispatcher'
-import type { RpcRequest } from '../core'
-import type { OrcaRuntimeService } from '../../orca-runtime'
-import { RUNTIME_CAPABILITIES } from '../../../../shared/protocol-version'
-import { SESSION_TABS_CREATE_TERMINAL_SHELL_RUNTIME_CAPABILITY } from '../../../../shared/session-tabs-runtime-capabilities'
-import { SESSION_TAB_METHODS } from './session-tabs'
-
-function makeRequest(params: unknown): RpcRequest {
- return { id: 'req-1', authToken: 'tok', method: 'session.tabs.createTerminal', params }
-}
-
-function makeRuntime(): OrcaRuntimeService {
- // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the handler only calls these two members.
- return {
- getRuntimeId: () => 'test-runtime',
- createMobileSessionTerminal: vi.fn().mockResolvedValue({
- tab: { type: 'terminal', id: 'tab-1::leaf-1' },
- publicationEpoch: 'epoch-1',
- snapshotVersion: 1
- })
- } as unknown as OrcaRuntimeService
-}
-
-describe('session.tabs.createTerminal shell selection', () => {
- it('advertises shell selection so clients stop typing the shell into the default one', () => {
- expect(RUNTIME_CAPABILITIES).toContain(SESSION_TABS_CREATE_TERMINAL_SHELL_RUNTIME_CAPABILITY)
- })
-
- it('creates the requested shell instead of a startup command', async () => {
- const runtime = makeRuntime()
- const dispatcher = new RpcDispatcher({ runtime, methods: SESSION_TAB_METHODS })
-
- const response = await dispatcher.dispatch(makeRequest({ worktree: 'id:wt-1', shell: 'Cmd' }))
-
- expect(response.ok).toBe(true)
- const opts = vi.mocked(runtime.createMobileSessionTerminal).mock.calls[0]?.[1]
- expect(opts).toMatchObject({ shellOverride: 'cmd.exe' })
- expect(opts?.command).toBeUndefined()
- })
-
- it('omits the override when no shell is requested', async () => {
- const runtime = makeRuntime()
- const dispatcher = new RpcDispatcher({ runtime, methods: SESSION_TAB_METHODS })
-
- await dispatcher.dispatch(makeRequest({ worktree: 'id:wt-1' }))
-
- const opts = vi.mocked(runtime.createMobileSessionTerminal).mock.calls[0]?.[1]
- expect(opts).not.toHaveProperty('shellOverride')
- })
-
- it('refuses a shell pick combined with an agent launch, whose plan picks its own shell', async () => {
- const runtime = makeRuntime()
- const dispatcher = new RpcDispatcher({ runtime, methods: SESSION_TAB_METHODS })
-
- const response = await dispatcher.dispatch(
- makeRequest({ worktree: 'id:wt-1', shell: 'cmd.exe', agent: 'claude' })
- )
-
- expect(response.ok).toBe(false)
- expect(runtime.createMobileSessionTerminal).not.toHaveBeenCalled()
- })
-
- it('refuses a shell outside the Windows allowlist before creating a terminal', async () => {
- const runtime = makeRuntime()
- const dispatcher = new RpcDispatcher({ runtime, methods: SESSION_TAB_METHODS })
-
- const response = await dispatcher.dispatch(makeRequest({ worktree: 'id:wt-1', shell: 'zsh' }))
-
- expect(response.ok).toBe(false)
- expect(runtime.createMobileSessionTerminal).not.toHaveBeenCalled()
- })
-})
diff --git a/src/main/runtime/rpc/methods/terminal/terminal-create-sort-stamp.test.ts b/src/main/runtime/rpc/methods/terminal/terminal-create-sort-stamp.test.ts
deleted file mode 100644
index ec73d46ac7e..00000000000
--- a/src/main/runtime/rpc/methods/terminal/terminal-create-sort-stamp.test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import '../../unused-default-rpc-methods.test-fixture'
-import { describe, expect, it, vi } from 'vitest'
-import type { OrcaRuntimeService } from '../../../orca-runtime'
-import { DESKTOP_RPC_CALLER } from '../../rpc-caller-identity'
-import { RpcDispatcher } from '../../dispatcher'
-import type { RpcDispatchStreamingOptions } from '../../dispatcher-stream-options'
-import { TERMINAL_LIFECYCLE_METHODS } from './terminal-lifecycle-methods'
-
-vi.mock('../../../../../shared/sidebar-inputs-switch', () => ({
- ORCA_SIDEBAR_INPUTS_IS_MAIN: true
-}))
-
-const WT = 'repo-1::/tmp/a'
-
-function makeHost(created: { isReattach?: true; savedStartupCwd?: string } = {}) {
- const noteTerminalStarted = vi.fn()
- const fake = {
- getRuntimeId: () => 'test-runtime',
- dedupeTerminalCreate: async () => ({
- handle: 'term-1',
- worktreeId: WT,
- title: null,
- ...created
- }),
- sidebarFacts: { sortStamps: { noteTerminalStarted } }
- }
- // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: terminal.create reads only the members above.
- const runtime = fake as unknown as OrcaRuntimeService
- const dispatcher = new RpcDispatcher({ runtime, methods: TERMINAL_LIFECYCLE_METHODS })
- const create = (context: RpcDispatchStreamingOptions) =>
- dispatcher.dispatch(
- {
- id: 'req-1',
- authToken: 'tok',
- method: 'terminal.create',
- params: { worktree: `id:${WT}` }
- },
- context
- )
- return { create, noteTerminalStarted }
-}
-
-describe('terminal.create sort stamp', () => {
- it('stamps a terminal the CLI starts', async () => {
- const host = makeHost({ savedStartupCwd: '/private/original' })
- const reply = await host.create({})
- expect(reply).toMatchObject({ ok: true })
- expect(JSON.stringify(reply)).not.toContain('savedStartupCwd')
- expect(host.noteTerminalStarted).toHaveBeenCalledWith(WT, undefined)
- })
-
- it('leaves a terminal a person opens in a window or on a phone, and a reattach', async () => {
- const window = makeHost()
- await window.create({ caller: DESKTOP_RPC_CALLER })
- const phone = makeHost()
- await phone.create({ clientKind: 'mobile', pairedDeviceId: 'phone-1' })
- const reattach = makeHost({ isReattach: true })
- await reattach.create({})
- expect(window.noteTerminalStarted).not.toHaveBeenCalled()
- expect(phone.noteTerminalStarted).not.toHaveBeenCalled()
- expect(reattach.noteTerminalStarted).not.toHaveBeenCalled()
- })
-})
diff --git a/src/main/runtime/runtime-extraction-regressions.test.ts b/src/main/runtime/runtime-extraction-regressions.test.ts
deleted file mode 100644
index 165926598ff..00000000000
--- a/src/main/runtime/runtime-extraction-regressions.test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import { join } from 'node:path'
-import { describe, expect, it, vi } from 'vitest'
-import { OrcaRuntimeService } from './orca-runtime'
-import { SESSION_TABS_AUTHORITATIVE_INVENTORY_RUNTIME_CAPABILITY } from '../../shared/protocol-version'
-import { partialRuntimeStore } from './runtime-store-partial-fixture'
-
-vi.mock('electron', () => ({
- BrowserWindow: { fromId: vi.fn(() => null) },
- webContents: { fromId: vi.fn(() => null) },
- ipcMain: { on: vi.fn(), removeListener: vi.fn() },
- app: { getPath: vi.fn(() => '/tmp') }
-}))
-
-describe('runtime extraction regressions', () => {
- it('wires the managed Claude config directory into skill discovery', async () => {
- const runtime = new OrcaRuntimeService()
- const getRuntimeConfigDir = vi.fn(() => '/accounts/claude/managed')
- runtime.setAccountServices({
- claudeAccounts: { getRuntimeConfigDir },
- codexAccounts: {},
- rateLimits: {}
- } as never)
-
- await expect(
- runtime.resolveSkillDiscoveryProviderRoots({ kind: 'native-host' })
- ).resolves.toMatchObject({ claude: join('/accounts/claude/managed', 'skills') })
- expect(getRuntimeConfigDir).toHaveBeenCalledWith({ runtime: 'host' })
- })
-
- it('does not create orchestration state for optional lineage lookups', () => {
- const runtime = new OrcaRuntimeService()
- const createDb = vi.spyOn(runtime, 'getOrchestrationDb')
- const internal = runtime as unknown as {
- getOrchestrationDbIfAvailable(): unknown
- }
-
- expect(internal.getOrchestrationDbIfAvailable()).toBeNull()
- expect(createDb).not.toHaveBeenCalled()
- })
-
- it('preserves the session-inventory capability gate in runtime status', () => {
- vi.stubEnv('ORCA_E2E_DISABLE_AUTHORITATIVE_SESSION_TABS_INVENTORY', '1')
- try {
- const runtime = new OrcaRuntimeService()
- expect(runtime.getStatus().capabilities).not.toContain(
- SESSION_TABS_AUTHORITATIVE_INVENTORY_RUNTIME_CAPABILITY
- )
- } finally {
- vi.unstubAllEnvs()
- }
- })
-
- it('reads a machine rename the same way status publishes it', () => {
- const settings = { machineName: 'Build server' }
- const runtime = new OrcaRuntimeService(partialRuntimeStore({ getSettings: () => settings }))
- expect(runtime.readMachineName()).toBe('Build server')
- expect(runtime.getStatus().hostPlatform).toBe(process.platform)
- settings.machineName = 'Renamed desk'
- expect(runtime.getStatus().machineName).toBe('Renamed desk')
- // The remote-workspace client identity reads this same accessor at send time.
- expect(runtime.readMachineName()).toBe('Renamed desk')
- })
-})
diff --git a/src/main/runtime/runtime-local-worktree-setup.test.ts b/src/main/runtime/runtime-local-worktree-setup.test.ts
deleted file mode 100644
index 87716eec98f..00000000000
--- a/src/main/runtime/runtime-local-worktree-setup.test.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import { beforeEach, describe, expect, it, vi } from 'vitest'
-import type { Repo } from '../../shared/repo-types'
-import { getDefaultRepoHookSettings } from '../../shared/constants'
-
-const mocks = vi.hoisted(() => ({
- effectiveHooks: vi.fn(),
- runHook: vi.fn()
-}))
-
-vi.mock('../hooks', () => ({
- getEffectiveHooks: mocks.effectiveHooks,
- loadHooks: () => null,
- runHook: mocks.runHook
-}))
-
-import { prepareRuntimeLocalWorktreeSetup } from './runtime-local-worktree-setup'
-
-const askRepo: Repo = {
- id: 'repo-1',
- path: '/repo',
- displayName: 'Repo',
- badgeColor: '#000000',
- addedAt: 0,
- hookSettings: { ...getDefaultRepoHookSettings(), setupRunPolicy: 'ask' }
-}
-
-function prepare(request: { setupDecision?: 'run' | 'skip' | 'inherit' } = {}) {
- return prepareRuntimeLocalWorktreeSetup({
- request: { repoSelector: 'repo-1', name: 'app', ...request },
- repo: askRepo,
- worktreePath: '/worktrees/app',
- // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: settings are read only by the setup runner, which this in-process path never builds.
- settings: {} as never,
- runtimeTarget: undefined,
- shouldUseSetupRunner: false
- })
-}
-
-describe('runtime create setup for a hook the new branch added', () => {
- beforeEach(() => {
- vi.resetAllMocks()
- mocks.runHook.mockResolvedValue({ success: true, output: '' })
- mocks.effectiveHooks.mockReturnValue({ scripts: { setup: 'pnpm install' } })
- })
-
- it('skips setup with a warning instead of failing a create that already added the worktree', async () => {
- const result = await prepare()
-
- expect(result.shouldRunSetup).toBe(false)
- expect(result.warning).toContain('pass --setup run to run it')
- expect(mocks.runHook).not.toHaveBeenCalled()
- })
-
- it('still runs setup when the caller decided to', async () => {
- const result = await prepare({ setupDecision: 'run' })
-
- expect(result.shouldRunSetup).toBe(true)
- expect(mocks.runHook).toHaveBeenCalledOnce()
- })
-})
diff --git a/src/main/skills/skill-provider-destinations.test.ts b/src/main/skills/skill-provider-destinations.test.ts
deleted file mode 100644
index 2f65debb24e..00000000000
--- a/src/main/skills/skill-provider-destinations.test.ts
+++ /dev/null
@@ -1,165 +0,0 @@
-import { join } from 'node:path'
-import { describe, expect, it } from 'vitest'
-import { selectedOrDetectedSkillProviders } from '../../shared/skill-install-providers'
-import { resolveSkillProviderDestinations } from './skill-provider-destinations'
-
-const HOME = join('/home', 'dev')
-const WORKSPACE = join('/repos', 'orca')
-
-describe('resolveSkillProviderDestinations', () => {
- it('gives an agent that reads the canonical root no placement of its own', () => {
- const destinations = resolveSkillProviderDestinations({
- scope: 'workspace',
- homeDirectory: HOME,
- workspaceDirectory: WORKSPACE,
- detectedProviders: ['codex']
- })
- expect(destinations).toEqual([
- {
- provider: 'codex',
- readsCanonicalRoot: true,
- rootPath: join(WORKSPACE, '.agents', 'skills')
- }
- ])
- })
-
- // Agents may use canonical workspace roots but private home roots; placement depends on scope.
- it('resolves scope-specific roots for an agent that is canonical in a workspace only', () => {
- const workspace = resolveSkillProviderDestinations({
- scope: 'workspace',
- homeDirectory: HOME,
- workspaceDirectory: WORKSPACE,
- detectedProviders: ['cursor']
- })
- const global = resolveSkillProviderDestinations({
- scope: 'global',
- homeDirectory: HOME,
- detectedProviders: ['cursor']
- })
- expect(workspace[0]).toMatchObject({ readsCanonicalRoot: true })
- expect(global[0]).toMatchObject({
- readsCanonicalRoot: false,
- rootPath: join(HOME, '.cursor', 'skills')
- })
- })
-
- it('places every detected agent that owns a directory', () => {
- const destinations = resolveSkillProviderDestinations({
- scope: 'global',
- homeDirectory: HOME,
- detectedProviders: ['codex', 'claude', 'droid', 'grok', 'aug', 'continue', 'trae']
- })
- expect(destinations.map((destination) => destination.rootPath)).toEqual([
- join(HOME, '.agents', 'skills'),
- join(HOME, '.claude', 'skills'),
- join(HOME, '.factory', 'skills'),
- join(HOME, '.continue', 'skills'),
- join(HOME, '.trae-cn', 'skills'),
- join(HOME, '.grok', 'skills'),
- join(HOME, '.augment', 'skills')
- ])
- })
-
- it('uses the canonical root for Codex at global scope', () => {
- expect(
- resolveSkillProviderDestinations({
- scope: 'global',
- homeDirectory: HOME,
- detectedProviders: ['codex']
- })
- ).toEqual([
- { provider: 'codex', readsCanonicalRoot: true, rootPath: join(HOME, '.agents', 'skills') }
- ])
- })
-
- it('honors custom global config roots without changing workspace roots', () => {
- const customClaudeRoot = join('/srv', 'claude', 'skills')
- expect(
- resolveSkillProviderDestinations({
- scope: 'global',
- homeDirectory: HOME,
- detectedProviders: ['claude'],
- providerRootOverrides: { claude: customClaudeRoot }
- })
- ).toEqual([{ provider: 'claude', readsCanonicalRoot: false, rootPath: customClaudeRoot }])
- expect(
- resolveSkillProviderDestinations({
- scope: 'workspace',
- homeDirectory: HOME,
- workspaceDirectory: WORKSPACE,
- detectedProviders: ['claude'],
- providerRootOverrides: { claude: customClaudeRoot }
- })[0]?.rootPath
- ).toBe(join(WORKSPACE, '.claude', 'skills'))
- })
-
- it('treats a custom root equal to canonical as canonical', () => {
- expect(
- resolveSkillProviderDestinations({
- scope: 'global',
- homeDirectory: HOME,
- detectedProviders: ['claude'],
- providerRootOverrides: { claude: join(HOME, '.agents', 'skills') }
- })
- ).toEqual([
- {
- provider: 'claude',
- readsCanonicalRoot: true,
- rootPath: join(HOME, '.agents', 'skills')
- }
- ])
- })
-
- it('rejects two providers claiming one noncanonical root', () => {
- const sharedRoot = join(HOME, '.custom-agent', 'skills')
- expect(() =>
- resolveSkillProviderDestinations({
- scope: 'global',
- homeDirectory: HOME,
- detectedProviders: ['claude', 'grok'],
- providerRootOverrides: { claude: sharedRoot, grok: sharedRoot }
- })
- ).toThrow('skill-install-provider-root-collision')
- })
-
- it('ignores agents Orca cannot place skills for', () => {
- expect(
- resolveSkillProviderDestinations({
- scope: 'global',
- homeDirectory: HOME,
- detectedProviders: ['aider', 'hermes', 'not-an-agent']
- })
- ).toEqual([])
- })
-
- it('requires a workspace directory for workspace scope', () => {
- expect(() =>
- resolveSkillProviderDestinations({
- scope: 'workspace',
- homeDirectory: HOME,
- detectedProviders: ['claude']
- })
- ).toThrow('skill-install-workspace-required')
- })
-})
-
-describe('selectedOrDetectedSkillProviders', () => {
- // Removal must find historical installs even after users narrow selected agents.
- it('keeps every detected agent when nothing was selected', () => {
- expect(selectedOrDetectedSkillProviders(['claude', 'codex'], undefined)).toEqual([
- 'claude',
- 'codex'
- ])
- })
-
- it('honors selected agents even when they are not currently detected', () => {
- expect(selectedOrDetectedSkillProviders(['claude', 'codex'], ['claude', 'cursor'])).toEqual([
- 'claude',
- 'cursor'
- ])
- })
-
- it('places nothing extra when the choice is empty', () => {
- expect(selectedOrDetectedSkillProviders(['claude', 'codex'], [])).toEqual([])
- })
-})
diff --git a/src/main/skills/skill-provider-discovery-coverage.test.ts b/src/main/skills/skill-provider-discovery-coverage.test.ts
deleted file mode 100644
index 079d20aa90a..00000000000
--- a/src/main/skills/skill-provider-discovery-coverage.test.ts
+++ /dev/null
@@ -1,108 +0,0 @@
-import { join, posix, resolve } from 'node:path'
-import { describe, expect, it } from 'vitest'
-import { SKILL_INSTALL_PROVIDERS } from '../../shared/skill-install-providers'
-import type { TuiAgent } from '../../shared/tui-agent'
-import { TUI_AGENT_CONFIG } from '../../shared/tui-agent-config'
-import { buildSkillDiscoverySources } from './skill-discovery-sources'
-import { resolveEnvironmentSkillProviderRoots } from './skill-provider-runtime-roots'
-
-const HOME = '/home/test'
-
-// New agents need a provider entry or an explicit unsupported reason.
-const AGENTS_WITHOUT_INSTALL_PROVIDER: Partial<Record<TuiAgent, string>> = {
- 'claude-agent-teams': 'detected only alongside claude, whose entry covers .claude/skills',
- aider: 'no skills support',
- hermes: 'Windows home under %LOCALAPPDATA% and opt-in project skills fit no table shape'
-}
-const WORKSPACE = '/workspace/current'
-
-function discover(providerRootOverrides = {}) {
- return buildSkillDiscoverySources({
- homeDir: HOME,
- cwd: WORKSPACE,
- pathApi: posix,
- providerRootOverrides
- })
-}
-
-describe('skill install provider table drives discovery', () => {
- it('lists every provider install folder at each scope it has one', () => {
- const sources = discover()
- for (const provider of SKILL_INSTALL_PROVIDERS) {
- if (provider.globalSegments) {
- expect(sources, provider.id).toContainEqual(
- expect.objectContaining({
- path: posix.join(HOME, ...provider.globalSegments),
- label: `${provider.displayName} home`,
- sourceKind: 'home',
- owner: provider.id
- })
- )
- }
- if (provider.workspaceSegments) {
- expect(sources, provider.id).toContainEqual(
- expect.objectContaining({
- path: posix.join(WORKSPACE, ...provider.workspaceSegments),
- sourceKind: 'repo',
- owner: provider.id
- })
- )
- }
- }
- expect(sources.map((source) => source.path)).toEqual(
- expect.arrayContaining([
- posix.join(HOME, '.agents', 'skills'),
- posix.join(WORKSPACE, '.agents', 'skills')
- ])
- )
- })
-
- it('relocates a provider home named by its env var for install and discovery alike', () => {
- for (const provider of SKILL_INSTALL_PROVIDERS) {
- if (!provider.homeEnv) {
- continue
- }
- const relocated = resolve('/srv', provider.id)
- const overrides = resolveEnvironmentSkillProviderRoots(
- { [provider.homeEnv]: relocated },
- resolve(HOME)
- )
- expect(overrides).toEqual({ [provider.id]: join(relocated, 'skills') })
- expect(
- discover(overrides).find(
- (source) => source.sourceKind === 'home' && source.owner === provider.id
- )?.path
- ).toBe(overrides[provider.id])
- }
- })
-
- it('names each provider home with a plain env var the WSL probe can expand', () => {
- for (const provider of SKILL_INSTALL_PROVIDERS) {
- if (provider.homeEnv) {
- expect(provider.homeEnv).toMatch(/^[A-Z_][A-Z0-9_]*$/u)
- }
- }
- })
-
- it('gives every Orca agent an entry or a recorded reason it has none', () => {
- const covered = new Set<string>(SKILL_INSTALL_PROVIDERS.map((provider) => provider.id))
- for (const agent of Object.keys(TUI_AGENT_CONFIG)) {
- expect(
- covered.has(agent) !== Object.hasOwn(AGENTS_WITHOUT_INSTALL_PROVIDER, agent),
- agent
- ).toBe(true)
- }
- })
-
- it('keeps scanning Qoder folders it still reads after installs moved to the canonical root', () => {
- const qoderPaths = discover()
- .filter((source) => source.owner === 'qoder')
- .map((source) => source.path)
- expect(qoderPaths).toEqual(
- expect.arrayContaining([
- posix.join(HOME, '.qoder', 'skills'),
- posix.join(WORKSPACE, '.qoder', 'skills')
- ])
- )
- })
-})
diff --git a/src/main/skills/skill-remote-error-category-parity.test.ts b/src/main/skills/skill-remote-error-category-parity.test.ts
deleted file mode 100644
index 193f817c5de..00000000000
--- a/src/main/skills/skill-remote-error-category-parity.test.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-import { beforeEach, describe, expect, it, vi } from 'vitest'
-import {
- SkillInstallFailureCategorySchema,
- type SkillInstallFailure
-} from '../../shared/skill-install-failure'
-import type { SkillInstallRequest } from '../../shared/skill-install-contract'
-
-const mocks = vi.hoisted(() => ({ callRuntimeEnvironment: vi.fn() }))
-
-vi.mock('../ipc/runtime-environments/runtime-environment-transport-routing', () => ({
- callRuntimeEnvironment: mocks.callRuntimeEnvironment
-}))
-
-import { skillInstallFailureFromError } from './skill-install-operation-error'
-import { installSkillOnRemoteRuntime } from './skill-remote-install-service'
-
-const request: SkillInstallRequest = {
- operationId: 'operation-1',
- package: {
- packageId: 'package-1',
- versionId: 'version-1',
- packageDigest: 'a'.repeat(64),
- archiveSha256: 'b'.repeat(64),
- compressedBytes: 12
- },
- ingress: {
- kind: 'download-grant',
- url: 'https://storage.googleapis.com/bucket/package.tar.gz',
- expiresAt: '2099-01-01T00:00:00.000Z'
- },
- destination: { scope: 'global' }
-}
-
-const failures = SkillInstallFailureCategorySchema.options.map(
- (category, index): SkillInstallFailure => ({
- category,
- code: `skill-contract-${category}`,
- retryable: index % 2 === 0
- })
-)
-
-async function capturedFailure(promise: Promise<unknown>): Promise<SkillInstallFailure | null> {
- try {
- await promise
- throw new Error('expected-skill-install-failure')
- } catch (error) {
- return skillInstallFailureFromError(error)
- }
-}
-
-describe('remote skill failure category', () => {
- beforeEach(() => {
- mocks.callRuntimeEnvironment.mockReset()
- })
-
- it.each(failures)('preserves $category from a paired runtime', async (failure) => {
- mocks.callRuntimeEnvironment.mockResolvedValue({
- id: 'rpc-1',
- ok: false,
- error: { code: 'skill_install_failure', message: failure.code, data: failure },
- _meta: { runtimeId: 'runtime-1' }
- })
- const paired = await capturedFailure(
- installSkillOnRemoteRuntime({
- userDataPath: '/state',
- environmentId: 'environment-1',
- request,
- capabilities: ['skills.install.v1'],
- requireHttps: true
- })
- )
-
- expect(paired).toEqual(failure)
- })
-})
diff --git a/src/main/startup/branch-rename-hook-subscription.test.ts b/src/main/startup/branch-rename-hook-subscription.test.ts
deleted file mode 100644
index 292f4a96c1b..00000000000
--- a/src/main/startup/branch-rename-hook-subscription.test.ts
+++ /dev/null
@@ -1,69 +0,0 @@
-import { beforeEach, describe, expect, it, vi } from 'vitest'
-import type { EnrichedAgentHookEventPayload } from '../agent-hooks/server'
-
-const hooks = vi.hoisted(() => {
- const listeners: ((event: EnrichedAgentHookEventPayload) => void)[] = []
- return { listeners, rename: vi.fn(() => Promise.resolve()) }
-})
-
-vi.mock('../agent-hooks/server', () => ({
- agentHookServer: {
- subscribeEnrichedStatus: (listener: (event: EnrichedAgentHookEventPayload) => void) => {
- hooks.listeners.push(listener)
- return () => {}
- }
- }
-}))
-vi.mock('../agent-hooks/first-work-branch-rename', () => ({
- maybeAutoRenameBranchOnFirstWork: hooks.rename
-}))
-vi.mock('../agent-hooks/first-work-rename-runtime', () => ({ firstWorkRenameDeps: () => ({}) }))
-
-import { installFirstWorkRenameHookSubscription } from './branch-rename-hook'
-import { mainProcessState } from './main-process-state'
-
-function working(over: Partial<EnrichedAgentHookEventPayload> = {}): EnrichedAgentHookEventPayload {
- // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the subscription reads only the routing, payload and gate fields set here.
- return {
- paneKey: 'pane-1',
- tabId: 'tab-1',
- worktreeId: 'repo::/wt',
- connectionId: null,
- receivedAt: 1,
- stateStartedAt: 1,
- payload: { state: 'working', prompt: 'Fix the auth bug', agentType: 'claude' },
- ...over
- } as EnrichedAgentHookEventPayload
-}
-
-beforeEach(() => {
- hooks.listeners.length = 0
- hooks.rename.mockClear()
- // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the rename entry only checks these singletons exist before handing them to the mocked deps.
- mainProcessState.store = {} as typeof mainProcessState.store
- // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: as above.
- mainProcessState.runtime = {} as typeof mainProcessState.runtime
-})
-
-// Headless serve has no window hook listener; the subscription must stand alone.
-describe('first-work rename hook subscription', () => {
- it('arms rename from the hook store with no window', () => {
- installFirstWorkRenameHookSubscription()
- hooks.listeners[0](working())
-
- expect(hooks.rename).toHaveBeenCalledTimes(1)
- expect(hooks.rename.mock.calls[0]).toEqual([
- expect.objectContaining({ paneKey: 'pane-1', state: 'working', prompt: 'Fix the auth bug' }),
- {}
- ])
- })
-
- it('keeps the window path gates: identity refreshes, restored rows and structured rows', () => {
- installFirstWorkRenameHookSubscription()
- hooks.listeners[0](working({ providerSessionOnly: true }))
- hooks.listeners[0](working({ restoredUnconfirmed: true }))
- hooks.listeners[0](working({ structuredHost: 'owned' }))
-
- expect(hooks.rename).not.toHaveBeenCalled()
- })
-})
diff --git a/src/main/startup/login-shell-environment-git-bash.test.ts b/src/main/startup/login-shell-environment-git-bash.test.ts
deleted file mode 100644
index d57a431559e..00000000000
--- a/src/main/startup/login-shell-environment-git-bash.test.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import { EventEmitter } from 'node:events'
-import { PassThrough } from 'node:stream'
-import { afterEach, expect, it, vi } from 'vitest'
-
-const { spawnProcessMock } = vi.hoisted(() => ({ spawnProcessMock: vi.fn() }))
-vi.mock('@orca/process-host', () => ({ spawnProcess: spawnProcessMock }))
-
-import {
- resetLoginShellEnvironmentCacheForTests,
- resolveLoginShellEnvironment
-} from './login-shell-environment'
-
-const originalPlatform = process.platform
-
-afterEach(() => {
- resetLoginShellEnvironmentCacheForTests()
- Object.defineProperty(process, 'platform', { value: originalPlatform })
-})
-
-// #30946: Git Bash's own env holds /c/... PATH and TEMP=/tmp, which native agent spawns cannot use.
-it('captures Git Bash env as a native Windows child sees it', async () => {
- Object.defineProperty(process, 'platform', { value: 'win32' })
- const nativeEnv = { Path: 'C:\\Users\\me\\npm-prefix;C:\\WINDOWS', TEMP: 'C:\\Users\\me\\Temp' }
- spawnProcessMock.mockImplementation(() => {
- const child = Object.assign(new EventEmitter(), {
- stdin: new PassThrough(),
- stdout: new PassThrough(),
- stderr: new PassThrough(),
- kill: vi.fn()
- })
- queueMicrotask(() => {
- child.stdout.write(
- `__ORCA_LOGIN_SHELL_ENV_START__${JSON.stringify(nativeEnv)}__ORCA_LOGIN_SHELL_ENV_END__`
- )
- child.emit('close', 0)
- })
- return child
- })
-
- const env = await resolveLoginShellEnvironment({
- shellOverride: 'C:\\Program Files\\Git\\bin\\bash.exe'
- })
-
- const [{ args }] = spawnProcessMock.mock.calls[0]
- expect(args[0]).toBe('-ilc')
- expect(args[1]).toMatch(/^powershell\.exe .*-EncodedCommand [A-Za-z0-9+/=]+$/)
- expect(env).toEqual(nativeEnv)
-})
diff --git a/src/main/worktree-runner-script-link.test.ts b/src/main/worktree-runner-script-link.test.ts
deleted file mode 100644
index 4527a9dfb47..00000000000
--- a/src/main/worktree-runner-script-link.test.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * The setup runner's path lookup with the D1c Git router on: read from the worktree's link, no Git
- * process; with it off, the host Git lookup main runs.
- */
-import type * as GitRunner from './git/runner'
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-import { makeHookTestRepo } from './hooks-test-fixtures'
-import { setLocalGitRuntimeRouter } from './git/command-runner/local-git-runtime-route'
-
-vi.mock('fs', () => ({
- readFileSync: vi.fn(),
- existsSync: vi.fn(),
- mkdirSync: vi.fn(),
- writeFileSync: vi.fn(),
- rmSync: vi.fn(),
- chmodSync: vi.fn()
-}))
-
-const { gitExecFileSyncMock, readWorktreeGitPathMock } = vi.hoisted(() => ({
- gitExecFileSyncMock: vi.fn(() => '/mnt/c/src/app/.git/orca/setup-runner.sh\n'),
- readWorktreeGitPathMock: vi.fn(
- (_worktree: string, _relative: string, _roots: readonly string[]): string | null =>
- String.raw`C:\src\app\.git\worktrees\fix\orca\setup-runner.sh`
- )
-}))
-
-vi.mock('./git/runner', async () => ({
- ...(await vi.importActual<typeof GitRunner>('./git/runner')),
- gitExecFileSync: gitExecFileSyncMock
-}))
-vi.mock('./git/worktree-git-path', () => ({ readWorktreeGitPath: readWorktreeGitPathMock }))
-
-const originalPlatform = process.platform
-const WORKTREE = String.raw`C:\src\app-fix`
-
-beforeEach(() => {
- Object.defineProperty(process, 'platform', { configurable: true, value: 'win32' })
- gitExecFileSyncMock.mockClear()
- readWorktreeGitPathMock.mockClear()
-})
-
-afterEach(() => {
- setLocalGitRuntimeRouter(null)
- Object.defineProperty(process, 'platform', { configurable: true, value: originalPlatform })
-})
-
-async function create() {
- const { createSetupRunnerScript } = await import('./worktree-runner-script')
- return createSetupRunnerScript(
- { ...makeHookTestRepo(), path: String.raw`C:\src\app` },
- WORKTREE,
- 'echo hello',
- { wslDistro: 'Ubuntu' }
- )
-}
-
-describe('createSetupRunnerScript git path for a WSL-runtime drive project', () => {
- it('reads the worktree link, starting no Git, with the router on', async () => {
- setLocalGitRuntimeRouter(() => 'Ubuntu')
- const result = await create()
- expect(readWorktreeGitPathMock).toHaveBeenCalledWith(
- WORKTREE,
- 'orca/setup-runner.sh',
- expect.arrayContaining(['/mnt/'])
- )
- expect(gitExecFileSyncMock).not.toHaveBeenCalled()
- expect(result.runnerScriptPath).toBe(
- String.raw`C:\src\app\.git\worktrees\fix\orca\setup-runner.sh`
- )
- })
-
- it('falls back to the host Git lookup when the link cannot be read', async () => {
- setLocalGitRuntimeRouter(() => 'Ubuntu')
- readWorktreeGitPathMock.mockReturnValueOnce(null)
- const result = await create()
- expect(gitExecFileSyncMock).toHaveBeenCalledOnce()
- expect(result.runnerScriptPath).toBe(String.raw`C:\src\app\.git\orca\setup-runner.sh`)
- })
-
- it('runs the host Git lookup main runs, with the router off', async () => {
- const result = await create()
- expect(readWorktreeGitPathMock).not.toHaveBeenCalled()
- expect(gitExecFileSyncMock).toHaveBeenCalledWith(
- ['rev-parse', '--git-path', 'orca/setup-runner.sh'],
- { cwd: WORKTREE, hostGit: true }
- )
- expect(result.runnerScriptPath).toBe(String.raw`C:\src\app\.git\orca\setup-runner.sh`)
- })
-})
diff --git a/src/main/wsl/wsl-home-unless-stopped.test.ts b/src/main/wsl/wsl-home-unless-stopped.test.ts
deleted file mode 100644
index de168936c9d..00000000000
--- a/src/main/wsl/wsl-home-unless-stopped.test.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { beforeEach, describe, expect, it, vi } from 'vitest'
-
-const mocks = vi.hoisted(() => ({
- getWslHomeAsync: vi.fn(async () => '\\\\wsl.localhost\\Ubuntu\\home\\jin'),
- getCachedWslHome: vi.fn((): string | null | undefined => undefined),
- blocked: vi.fn(async (): Promise<{ distro: string; state: string } | null> => null)
-}))
-vi.mock('../wsl', () => ({ getWslHomeAsync: mocks.getWslHomeAsync }))
-vi.mock('../wsl-home-cache', () => ({ getCachedWslHome: mocks.getCachedWslHome }))
-vi.mock('./wsl-unc-access-gate', () => ({ blockedWslDistroForPath: mocks.blocked }))
-
-import { wslHomeUnlessStopped } from './wsl-home-unless-stopped'
-
-beforeEach(() => {
- vi.clearAllMocks()
-})
-
-// getAllowedRoots runs on every file authorization; an uncached home probe would boot the distro (E9).
-describe('wslHomeUnlessStopped', () => {
- it('does not probe the home of a stopped distro', async () => {
- mocks.blocked.mockResolvedValueOnce({ distro: 'Ubuntu', state: 'stopped' })
- await expect(wslHomeUnlessStopped('Ubuntu')).resolves.toBeNull()
- expect(mocks.blocked).toHaveBeenCalledWith('', 'Ubuntu')
- expect(mocks.getWslHomeAsync).not.toHaveBeenCalled()
- })
-
- it('probes a running distro, and a cached home without asking', async () => {
- await expect(wslHomeUnlessStopped('Ubuntu')).resolves.toContain('jin')
- mocks.getCachedWslHome.mockReturnValueOnce('\\\\wsl.localhost\\Ubuntu\\home\\jin')
- await wslHomeUnlessStopped('Ubuntu')
- expect(mocks.blocked).toHaveBeenCalledOnce()
- })
-})
diff --git a/src/main/wsl/wsl-orcad-liveness-wiring.test.ts b/src/main/wsl/wsl-orcad-liveness-wiring.test.ts
deleted file mode 100644
index 924f8c62052..00000000000
--- a/src/main/wsl/wsl-orcad-liveness-wiring.test.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import { beforeEach, expect, it, vi } from 'vitest'
-import type { WslOrcadLivenessDependencies } from './wsl-orcad-liveness-state'
-
-const mocks = vi.hoisted(() => {
- const captured: { deps: WslOrcadLivenessDependencies | null } = { deps: null }
- return { readSettled: vi.fn(), captured }
-})
-vi.mock('../wsl-background-distro-gate', () => ({
- deferUntilWslDistroRunning: vi.fn(),
- readSettledConfirmedRunningWslDistros: mocks.readSettled
-}))
-vi.mock('./wsl-orcad-liveness-supervisor', () => ({
- WslOrcadLivenessSupervisor: class {
- constructor(deps: WslOrcadLivenessDependencies) {
- mocks.captured.deps = deps
- }
- }
-}))
-
-import { createWslOrcadLivenessSupervisor } from './wsl-orcad-liveness-wiring'
-import { EXIT_SETTLE_MS } from './wsl-orcad-liveness-evidence'
-
-beforeEach(() => {
- mocks.readSettled.mockReset().mockResolvedValue({ status: 'confirmed', distros: ['Ubuntu'] })
- createWslOrcadLivenessSupervisor({
- // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the captured deps under test never touch these.
- manager: {} as never,
- // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the captured deps under test never touch these.
- bridgeActivity: {} as never,
- // oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the captured deps under test never touch these.
- holder: {} as never,
- hasUserVisibleWork: () => false
- })
-})
-
-it('reads a settled running list for heartbeats and recovery, not one probed mid-stop (E9)', async () => {
- await mocks.captured.deps?.readRunning({ distro: 'Ubuntu' })
- expect(mocks.readSettled).toHaveBeenLastCalledWith('Ubuntu', undefined)
-
- await mocks.captured.deps?.readRunning({ distro: 'Ubuntu', exitedAt: 1_000 })
- expect(mocks.readSettled).toHaveBeenLastCalledWith('Ubuntu', 1_000 + EXIT_SETTLE_MS)
-})
-
-it('checks a no-boot reconnect against a settled read of its own distro (E9)', async () => {
- await expect(mocks.captured.deps?.requireRunning?.('Ubuntu')).resolves.toBe(true)
- expect(mocks.readSettled).toHaveBeenLastCalledWith('Ubuntu')
-
- mocks.readSettled.mockResolvedValue({ status: 'confirmed', distros: [] })
- await expect(mocks.captured.deps?.requireRunning?.('Ubuntu')).resolves.toBe(false)
-})
-
-it('makes each stopping-window poll take a fresh probe, never the list read before it', async () => {
- await mocks.captured.deps?.readRunning({ distro: 'Ubuntu', exitedAt: 1_000, probedAfter: 4_000 })
- expect(mocks.readSettled).toHaveBeenLastCalledWith('Ubuntu', 4_000)
-
- // A poll is never older than the exit's settle window.
- await mocks.captured.deps?.readRunning({ distro: 'Ubuntu', exitedAt: 1_000, probedAfter: 1_200 })
- expect(mocks.readSettled).toHaveBeenLastCalledWith('Ubuntu', 1_000 + EXIT_SETTLE_MS)
-})
diff --git a/src/renderer/src/components/right-sidebar/FileExplorerScopeNotice.test.tsx b/src/renderer/src/components/right-sidebar/FileExplorerScopeNotice.test.tsx
deleted file mode 100644
index 34bfac75390..00000000000
--- a/src/renderer/src/components/right-sidebar/FileExplorerScopeNotice.test.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-// @vitest-environment happy-dom
-import { cleanup, fireEvent, render as renderComponent, screen } from '@testing-library/react'
-import type { ReactNode } from 'react'
-import { afterEach, expect, it, vi } from 'vitest'
-import { TooltipProvider } from '@/components/ui/tooltip'
-import { FileExplorerScopeNotice } from './FileExplorerScopeNotice'
-
-const render = (ui: ReactNode) => renderComponent(ui, { wrapper: TooltipProvider })
-afterEach(cleanup)
-const props = {
- returnRoot: null,
- onSelectRoot: vi.fn(),
- disabled: false,
- searching: false,
- sparse: true
-}
-
-it('keeps checkout guidance behind a keyboard-accessible disclosure', () => {
- render(<FileExplorerScopeNotice {...props} />)
- expect(screen.getByText('Sparse checkout')).toBeTruthy()
- expect(screen.queryByText(/The folder picker changes/)).toBeNull()
- fireEvent.click(screen.getByRole('button', { name: 'About sparse checkout scope' }))
- expect(screen.getByText(/The folder picker changes/)).toBeTruthy()
- expect(screen.getByText(/Contents searches across the workspace/)).toBeTruthy()
-})
-
-it('labels content search scope without implying all repository files are present', () => {
- render(<FileExplorerScopeNotice {...props} searching />)
- expect(screen.getByText('Search scope: workspace files')).toBeTruthy()
- expect(screen.getAllByRole('button')).toHaveLength(1)
-})
-
-it('keeps return navigation alongside scope details and honors drag disabling', () => {
- const onSelectRoot = vi.fn()
- const returnRoot = { value: 'apps/web', label: 'apps/web' }
- const { rerender } = render(
- <FileExplorerScopeNotice {...props} returnRoot={returnRoot} onSelectRoot={onSelectRoot} />
- )
- fireEvent.click(screen.getByRole('button', { name: 'Back to apps/web' }))
- expect(onSelectRoot).toHaveBeenCalledWith('apps/web')
- expect(screen.getByRole('button', { name: 'About sparse checkout scope' })).toBeTruthy()
- rerender(<FileExplorerScopeNotice {...props} returnRoot={returnRoot} disabled />)
- expect(screen.getByRole('button', { name: 'Back to apps/web' }).hasAttribute('disabled')).toBe(
- true
- )
-})
-
-it('adds no sparse chrome to ordinary or folder workspaces', () => {
- const { container } = render(<FileExplorerScopeNotice {...props} sparse={false} />)
- expect(container.textContent).toBe('')
-})
-
-it('places the active folder choice in the scope row and retains the return action', () => {
- render(
- <FileExplorerScopeNotice
- {...props}
- rootSelect={{
- options: [
- { value: '/', label: 'Repository root' },
- { value: 'packages/ui', label: 'packages/ui' }
- ],
- value: '/',
- disabled: false,
- onValueChange: vi.fn()
- }}
- returnRoot={{ value: 'packages/ui', label: 'packages/ui' }}
- />
- )
- expect(screen.getByRole('button', { name: 'Explorer root' }).textContent).toContain(
- 'Repository root'
- )
- expect(screen.getByRole('button', { name: 'Back to packages/ui' })).toBeTruthy()
-})
diff --git a/src/renderer/src/components/right-sidebar/source-control-launch-agent-args-applicability.test.ts b/src/renderer/src/components/right-sidebar/source-control-launch-agent-args-applicability.test.ts
deleted file mode 100644
index dfbc7b9c422..00000000000
--- a/src/renderer/src/components/right-sidebar/source-control-launch-agent-args-applicability.test.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-import { beforeEach, describe, expect, it, vi } from 'vitest'
-
-const mocks = vi.hoisted(() => ({
- resolveAgentSessionLaunchRoute: vi.fn(),
- getState: vi.fn(() => ({}))
-}))
-
-vi.mock('@/lib/agent-session-launch-plan', () => ({
- resolveAgentSessionLaunchRoute: mocks.resolveAgentSessionLaunchRoute
-}))
-vi.mock('@/store', () => ({ useAppStore: { getState: mocks.getState } }))
-
-import { sourceControlLaunchAppliesAgentArgs } from './source-control-launch-agent-args-applicability'
-
-describe('sourceControlLaunchAppliesAgentArgs', () => {
- beforeEach(() => {
- vi.clearAllMocks()
- mocks.resolveAgentSessionLaunchRoute.mockReturnValue('terminal-tui')
- })
-
- it('applies arguments when the user launches into a terminal by default', () => {
- expect(
- sourceControlLaunchAppliesAgentArgs({
- agent: 'codex',
- worktreeId: 'wt-1'
- })
- ).toBe(true)
- })
-
- it('drops arguments only when this launch would really be a structured session', () => {
- mocks.resolveAgentSessionLaunchRoute.mockReturnValue('structured-native-chat')
- expect(
- sourceControlLaunchAppliesAgentArgs({
- agent: 'codex',
- worktreeId: 'wt-1'
- })
- ).toBe(false)
- })
-
- it('keeps arguments for a chat-by-default user whose launch falls back to a terminal', () => {
- // A remote host, an agent without a structured session, or a floating workspace all land here.
- mocks.resolveAgentSessionLaunchRoute.mockReturnValue('terminal-tui')
- expect(
- sourceControlLaunchAppliesAgentArgs({
- agent: 'codex',
- worktreeId: 'wt-1'
- })
- ).toBe(true)
- })
-
- it('applies arguments while no agent is chosen yet', () => {
- expect(
- sourceControlLaunchAppliesAgentArgs({
- agent: null,
- worktreeId: 'wt-1'
- })
- ).toBe(true)
- expect(mocks.resolveAgentSessionLaunchRoute).not.toHaveBeenCalled()
- })
-
- it('names the repo and its host when the workspace does not exist yet', () => {
- sourceControlLaunchAppliesAgentArgs({
- agent: 'codex',
- repoId: 'repo-1',
- executionHostId: 'ssh:build-box'
- })
- expect(mocks.resolveAgentSessionLaunchRoute).toHaveBeenCalledWith(
- expect.anything(),
- expect.objectContaining({
- workspace: {
- kind: 'git-worktree',
- repoId: 'repo-1',
- executionHostId: 'ssh:build-box'
- }
- })
- )
- })
-})
diff --git a/src/renderer/src/components/status-bar/resource-session-navigation.test.ts b/src/renderer/src/components/status-bar/resource-session-navigation.test.ts
deleted file mode 100644
index 28625ea6027..00000000000
--- a/src/renderer/src/components/status-bar/resource-session-navigation.test.ts
+++ /dev/null
@@ -1,77 +0,0 @@
-import { describe, expect, it, vi } from 'vitest'
-import {
- isResourceSessionActivationKey,
- navigateResourceSessionToTab,
- type ResourceSessionNavigationDeps
-} from './resource-session-navigation'
-
-const TAB_ID = 'tab-1'
-const OTHER_TAB_ID = 'tab-2'
-const LEAF_ID = '11111111-1111-4111-8111-111111111111'
-
-function makeDeps(events: string[] = []): ResourceSessionNavigationDeps {
- return {
- tabsByWorktree: {
- 'wt-1': [{ id: TAB_ID }],
- 'wt-2': [{ id: OTHER_TAB_ID }]
- },
- setActiveView: vi.fn((view: 'terminal') => events.push(`view:${view}`)),
- activateAndRevealWorktree: vi.fn((worktreeId: string) => {
- events.push(`worktree:${worktreeId}`)
- }),
- activateTabAndFocusPane: vi.fn((tabId: string, leafId: string | null) => {
- events.push(`tab:${tabId}:${leafId ?? 'null'}`)
- })
- }
-}
-
-describe('resource session navigation', () => {
- it('reveals the owning worktree and focuses a matching pane without dismissing the manager', () => {
- const events: string[] = []
- const deps = makeDeps(events)
-
- navigateResourceSessionToTab(TAB_ID, `${TAB_ID}:${LEAF_ID}`, deps)
-
- expect(events).toEqual(['worktree:wt-1', 'view:terminal', `tab:${TAB_ID}:${LEAF_ID}`])
- expect(deps.activateTabAndFocusPane).toHaveBeenCalledWith(TAB_ID, LEAF_ID, {
- flashFocusedPane: true,
- scrollToBottomIfOutputSinceLastView: true
- })
- })
-
- it('degrades malformed and mismatched pane keys to tab-only activation', () => {
- const malformed = makeDeps()
- navigateResourceSessionToTab(TAB_ID, `${TAB_ID}:1`, malformed)
- expect(malformed.activateTabAndFocusPane).toHaveBeenCalledWith(TAB_ID, null, {
- flashFocusedPane: true,
- scrollToBottomIfOutputSinceLastView: true
- })
-
- const mismatched = makeDeps()
- navigateResourceSessionToTab(TAB_ID, `${OTHER_TAB_ID}:${LEAF_ID}`, mismatched)
- expect(mismatched.activateTabAndFocusPane).toHaveBeenCalledWith(TAB_ID, null, {
- flashFocusedPane: true,
- scrollToBottomIfOutputSinceLastView: true
- })
- })
-
- it('still activates the tab and switches to terminal when the worktree mapping is stale', () => {
- const deps = makeDeps()
- deps.tabsByWorktree = {}
-
- navigateResourceSessionToTab(TAB_ID, `${TAB_ID}:${LEAF_ID}`, deps)
-
- expect(deps.activateAndRevealWorktree).not.toHaveBeenCalled()
- expect(deps.setActiveView).toHaveBeenCalledWith('terminal')
- expect(deps.activateTabAndFocusPane).toHaveBeenCalledWith(TAB_ID, LEAF_ID, {
- flashFocusedPane: true,
- scrollToBottomIfOutputSinceLastView: true
- })
- })
-
- it('keeps keyboard activation equivalent to click for Enter and Space only', () => {
- expect(isResourceSessionActivationKey('Enter')).toBe(true)
- expect(isResourceSessionActivationKey(' ')).toBe(true)
- expect(isResourceSessionActivationKey('Escape')).toBe(false)
- })
-})
diff --git a/src/renderer/src/components/task-page/jira/task-page-jira-item-source-context.test.ts b/src/renderer/src/components/task-page/jira/task-page-jira-item-source-context.test.ts
deleted file mode 100644
index c5ba753d1eb..00000000000
--- a/src/renderer/src/components/task-page/jira/task-page-jira-item-source-context.test.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import type { JiraIssue, JiraSite } from '../../../../../shared/jira/jira-types'
-import type { TaskSourceContext } from '../../../../../shared/task-source-context'
-import { bindTaskPageJiraItemSourceContext } from './task-page-jira-item-source-context'
-
-const SOURCE_CONTEXT: TaskSourceContext = {
- kind: 'task-source',
- provider: 'jira',
- projectId: 'project-1',
- hostId: 'runtime:env-1'
-}
-
-const SITES: JiraSite[] = [
- {
- id: 'site-a',
- siteUrl: 'https://a.atlassian.net',
- email: '[email protected]',
- displayName: 'Site A',
- accountId: 'account-a'
- },
- {
- id: 'site-b',
- siteUrl: 'https://b.atlassian.net/jira',
- email: '[email protected]',
- displayName: 'Site B',
- accountId: 'account-b'
- }
-]
-
-const ISSUE = {
- key: 'ORCA-123',
- siteId: 'site-b',
- project: { key: 'ORCA' }
-} as JiraIssue
-
-describe('TaskPage Jira item source context', () => {
- it('binds an All-sites result to its originating Jira site and project', () => {
- expect(
- bindTaskPageJiraItemSourceContext({
- issue: ISSUE,
- sites: SITES,
- sourceContext: SOURCE_CONTEXT
- })
- ).toMatchObject({
- hostId: 'runtime:env-1',
- accountLabel: '[email protected]',
- providerIdentity: {
- provider: 'jira',
- siteId: 'site-b',
- siteUrl: 'https://b.atlassian.net/jira',
- projectKey: 'ORCA'
- }
- })
- })
-
- it('refuses to bind an issue whose originating site is unavailable', () => {
- expect(
- bindTaskPageJiraItemSourceContext({
- issue: { ...ISSUE, siteId: 'missing' },
- sites: SITES,
- sourceContext: SOURCE_CONTEXT
- })
- ).toBeNull()
- })
-})
diff --git a/src/renderer/src/components/terminal-pane/terminal-ssh-sign-in-error.test.ts b/src/renderer/src/components/terminal-pane/terminal-ssh-sign-in-error.test.ts
deleted file mode 100644
index 6691e865b91..00000000000
--- a/src/renderer/src/components/terminal-pane/terminal-ssh-sign-in-error.test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-// @vitest-environment happy-dom
-
-import React from 'react'
-import { cleanup, render } from '@testing-library/react'
-import { afterEach, describe, expect, it, vi } from 'vitest'
-
-const environmentMocks = vi.hoisted(() => ({
- resolveFooter: vi.fn(async () => '---\nOrca: test')
-}))
-
-vi.mock('@/lib/client-environment-info', () => ({
- resolveClientEnvironmentFooter: environmentMocks.resolveFooter
-}))
-
-import { TerminalErrorToast } from './TerminalErrorToast'
-
-afterEach(() => {
- cleanup()
-})
-
-const SIGN_IN_AWAITED =
- "Error invoking remote method 'runtimeEnvironments:call': Error: pwhost needs you to sign in. Reconnect to sign in."
-
-describe('TerminalErrorToast for a host waiting for the user to sign in', () => {
- it('reads as the sentence main wrote, as an SSH state rather than a bug to report', () => {
- const view = render(
- React.createElement(TerminalErrorToast, { error: SIGN_IN_AWAITED, onDismiss: vi.fn() })
- )
-
- const toast = view.container.querySelector('[data-terminal-error-toast]')
- expect(toast?.getAttribute('data-terminal-error-kind')).toBe('ssh')
- expect(view.container.textContent).toContain(
- 'pwhost needs you to sign in. Reconnect to sign in.'
- )
- expect(view.container.textContent).not.toContain('Error invoking remote method')
- expect(view.container.textContent).not.toContain('file an issue')
- expect(environmentMocks.resolveFooter).not.toHaveBeenCalled()
- })
-
- it('treats a cancelled sign-in the same way', () => {
- const view = render(
- React.createElement(TerminalErrorToast, {
- error:
- "Error invoking remote method 'pty:spawn': Error: SSH sign-in for pwhost was cancelled. Reconnect to sign in again.",
- onDismiss: vi.fn()
- })
- )
-
- expect(view.container.textContent).not.toContain('file an issue')
- expect(view.container.textContent).toContain('SSH sign-in for pwhost was cancelled.')
- })
-
- it('keeps the issue link when another failure shares the toast', () => {
- const view = render(
- React.createElement(TerminalErrorToast, {
- error: `${SIGN_IN_AWAITED}\nPaste failed.`,
- onDismiss: vi.fn()
- })
- )
-
- expect(view.container.textContent).toContain('file an issue')
- })
-})
diff --git a/src/renderer/src/components/wsl-drive-project/WslDriveProjectGitRow.test.tsx b/src/renderer/src/components/wsl-drive-project/WslDriveProjectGitRow.test.tsx
deleted file mode 100644
index 5f2315c919d..00000000000
--- a/src/renderer/src/components/wsl-drive-project/WslDriveProjectGitRow.test.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import { renderToStaticMarkup } from 'react-dom/server'
-import { describe, expect, it, vi } from 'vitest'
-import {
- resolveProjectExecutionRuntime,
- type LocalWindowsRuntimePreference
-} from '../../../../shared/project-execution-runtime'
-import { WslDriveProjectGitRow } from './WslDriveProjectGitRow'
-import { wslDriveProjectBlockerMessage } from './wsl-drive-project-copy'
-
-function render(preference: LocalWindowsRuntimePreference, repoPath = String.raw`C:\src\app`) {
- return renderToStaticMarkup(
- <WslDriveProjectGitRow
- projectId="p1"
- repoPath={repoPath}
- resolution={resolveProjectExecutionRuntime({
- appPlatform: 'win32',
- projectId: 'p1',
- projectRuntimePreference: preference
- })}
- updateProject={vi.fn()}
- />
- )
-}
-
-describe('WslDriveProjectGitRow', () => {
- it('offers Git for Windows to a WSL project on a Windows drive', () => {
- const html = render({ kind: 'wsl', distro: 'Ubuntu' })
- expect(html).toContain('Use Git for Windows')
- expect(html).toContain('terminals and agents stay in Ubuntu')
- })
-
- it('says where Git and terminals run once converted, with nothing to click', () => {
- const html = render({ kind: 'wsl', distro: 'Ubuntu', git: 'windows-host' })
- expect(html).toContain('Orca runs Git on Windows for this project')
- expect(html).not.toContain('<button')
- })
-
- it('shows nothing for a Windows project or a project inside the distro', () => {
- expect(render({ kind: 'windows-host' })).toBe('')
- expect(
- render({ kind: 'wsl', distro: 'Ubuntu' }, String.raw`\\wsl.localhost\Ubuntu\home\me\app`)
- ).toBe('')
- })
-
- it('names the WSL-made workspaces that block the switch', () => {
- expect(
- wslDriveProjectBlockerMessage({
- kind: 'wsl-authored-worktrees',
- repoId: 'r1',
- paths: ['/home/me/orca/workspaces/app/fix']
- })
- ).toContain('/home/me/orca/workspaces/app/fix')
- })
-})
diff --git a/src/renderer/src/store/slices/github-issue-source-indicator-suppression.test.ts b/src/renderer/src/store/slices/github-issue-source-indicator-suppression.test.ts
deleted file mode 100644
index a1c0b8ff1fe..00000000000
--- a/src/renderer/src/store/slices/github-issue-source-indicator-suppression.test.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-import { describe, expect, it } from 'vitest'
-import './github-slice-test-harness'
-
-describe('IssueSourceIndicator suppression', () => {
- it('hides when sources deep-equal, shows when they differ, hides when either is null', async () => {
- const { default: IssueSourceIndicator, sameGitHubOwnerRepo } =
- await import('../../components/github/IssueSourceIndicator')
- const React = await import('react')
- const { renderToStaticMarkup } = await import('react-dom/server')
-
- expect(sameGitHubOwnerRepo({ owner: 'o', repo: 'r' }, { owner: 'o', repo: 'r' })).toBe(true)
- // Repo slug comparison is case-insensitive; equivalent owners convey no source change.
- expect(
- sameGitHubOwnerRepo({ owner: 'StablyAI', repo: 'Orca' }, { owner: 'stablyai', repo: 'orca' })
- ).toBe(true)
- expect(
- sameGitHubOwnerRepo(
- { owner: 'stablyai', repo: 'orca', host: 'github.com' },
- { owner: 'stablyai', repo: 'orca', host: 'ghe.example.test' }
- )
- ).toBe(false)
- expect(sameGitHubOwnerRepo({ owner: 'a', repo: 'r' }, { owner: 'b', repo: 'r' })).toBe(false)
-
- const sameEl = React.createElement(IssueSourceIndicator, {
- issues: { owner: 'o', repo: 'r' },
- prs: { owner: 'o', repo: 'r' }
- })
- expect(renderToStaticMarkup(sameEl)).toBe('')
-
- const nullIssueEl = React.createElement(IssueSourceIndicator, {
- issues: null,
- prs: { owner: 'o', repo: 'r' }
- })
- expect(renderToStaticMarkup(nullIssueEl)).toBe('')
-
- const diffEl = React.createElement(IssueSourceIndicator, {
- issues: { owner: 'up', repo: 'r' },
- prs: { owner: 'fork', repo: 'r' }
- })
- const defaultMarkup = renderToStaticMarkup(diffEl)
- expect(defaultMarkup).toContain('up/r')
- expect(defaultMarkup).toContain('Issues from')
-
- // Item surfaces annotate one issue, so use singular prefix.
- const itemEl = React.createElement(IssueSourceIndicator, {
- issues: { owner: 'up', repo: 'r' },
- prs: { owner: 'fork', repo: 'r' },
- variant: 'item'
- })
- const itemMarkup = renderToStaticMarkup(itemEl)
- expect(itemMarkup).toContain('up/r')
- expect(itemMarkup).toContain('Issue from')
- expect(itemMarkup).not.toContain('Issues from')
-
- const enterpriseEl = React.createElement(IssueSourceIndicator, {
- issues: { owner: 'up', repo: 'r', host: 'ghe.example.test' },
- prs: { owner: 'fork', repo: 'r', host: 'ghe.example.test' }
- })
- expect(renderToStaticMarkup(enterpriseEl)).toContain('ghe.example.test/up/r')
- })
-})