From 8063a699241f636e1c485fed97621804aef34f00 Mon Sep 17 00:00:00 2001 From: OrcaWin Date: Fri, 13 Nov 2026 16:01:56 -0800 Subject: [PATCH] test: remove low-value layout and daemon suites (#42198) Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com> --- .../daemon-automatic-work-guard.test.ts | 44 ---------- .../daemon-init-provider-installation.test.ts | 16 ---- .../testing/daemon-provider-census.test.ts | 8 +- .../testing/reattach-snapshot.test.ts | 39 --------- .../system-ssh-binary.test.ts | 23 ------ .../projects/project-board-columns.test.ts | 16 ---- .../sidebar-inputs-feed-installer.test.ts | 18 ----- .../workspace-layout-default-tabs.test.ts | 25 ------ .../workspace-layout-initial-surface.test.ts | 59 -------------- .../workspace-layout-move-tab-pin.test.ts | 75 ----------------- .../workspace-layout-ratio-commands.test.ts | 80 ------------------- .../workspace-layout-resume-record.test.ts | 29 ------- .../workspace-layout-simulator-tab.test.ts | 58 -------------- 13 files changed, 1 insertion(+), 489 deletions(-) delete mode 100644 src/main/daemon/admission/testing/daemon-automatic-work-guard.test.ts delete mode 100644 src/main/daemon/sessions/testing/reattach-snapshot.test.ts delete mode 100644 src/shared/workspace-layout/commands/workspace-layout-default-tabs.test.ts delete mode 100644 src/shared/workspace-layout/commands/workspace-layout-initial-surface.test.ts delete mode 100644 src/shared/workspace-layout/commands/workspace-layout-move-tab-pin.test.ts delete mode 100644 src/shared/workspace-layout/commands/workspace-layout-simulator-tab.test.ts diff --git a/src/main/daemon/admission/testing/daemon-automatic-work-guard.test.ts b/src/main/daemon/admission/testing/daemon-automatic-work-guard.test.ts deleted file mode 100644 index 2b37060c3d7..00000000000 --- a/src/main/daemon/admission/testing/daemon-automatic-work-guard.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { mkdtempSync, readFileSync, rmSync } from 'node:fs' -import { tmpdir } from 'node:os' -import { join } from 'node:path' -import { describe, expect, it, vi } from 'vitest' -import { DaemonAutomaticWorkGuard } from '../daemon-automatic-work-guard' -import { DaemonProcessGrowthMonitor } from '../daemon-process-growth-monitor' - -describe('DaemonAutomaticWorkGuard stop request', () => { - it('records an outside stop on the marker before teardown, so a cut-short exit is no crash', () => { - const dir = mkdtempSync(join(tmpdir(), 'orca-stop-')) - try { - const markerPath = join(dir, 'daemon-v1.automatic-work-run.json') - const options = { - markerPath, - mode: 'enforce' as const, - log: { log: vi.fn() }, - listSessions: () => [], - ownsEndpoint: () => true, - monitor: new DaemonProcessGrowthMonitor({ - listSessions: () => [], - recentAutomaticWork: () => false, - sampleWhenIdle: false, - onLevelChanged: () => {}, - onTrip: () => {}, - readRows: async () => [] - }) - } - const guard = new DaemonAutomaticWorkGuard(options) - guard.start() - guard['marker'].arm() - expect(JSON.parse(readFileSync(markerPath, 'utf8'))).toMatchObject({ state: 'running' }) - - guard.recordStopRequested() - - expect(JSON.parse(readFileSync(markerPath, 'utf8'))).toMatchObject({ state: 'clean-exit' }) - const next = new DaemonAutomaticWorkGuard(options) - next.start() - expect(next.status().mode).toEqual({ kind: 'normal' }) - next.stop() - } finally { - rmSync(dir, { recursive: true, force: true }) - } - }) -}) diff --git a/src/main/daemon/providers/lifecycle/testing/daemon-init-provider-installation.test.ts b/src/main/daemon/providers/lifecycle/testing/daemon-init-provider-installation.test.ts index 941f281c0f2..016db7e2999 100644 --- a/src/main/daemon/providers/lifecycle/testing/daemon-init-provider-installation.test.ts +++ b/src/main/daemon/providers/lifecycle/testing/daemon-init-provider-installation.test.ts @@ -82,22 +82,6 @@ describe('daemon-init: runRestartDaemon (7-step sequence)', () => { expect(setLocalPtyProviderMock).not.toHaveBeenCalled() }) - it('does not kill a preserved daemon when startup lease acquisition fails', async () => { - const mod = await importFresh() - ensureRunningOverrides.push(async () => ({ - socketPath: '/fake/preserved-socket', - tokenPath: '/fake/preserved-token' - })) - lifecycleLeaseErrors.push(new Error('preserved lease failed')) - - await expect(mod.initDaemonPtyProvider()).rejects.toThrow('preserved lease failed') - - expect(adoptionLeaseReleases[0]).toHaveBeenCalledOnce() - expect(adapterInstances[0].disconnectOnly).toHaveBeenCalledOnce() - expect(spawnerInstances[0].shutdown).not.toHaveBeenCalled() - expect(setLocalPtyProviderMock).not.toHaveBeenCalled() - }) - it('does not install a late daemon provider after startup fallback aborts the init attempt', async () => { const mod = await importFresh() let resolveEnsureRunning!: (value: { socketPath: string; tokenPath: string }) => void diff --git a/src/main/daemon/providers/lifecycle/testing/daemon-provider-census.test.ts b/src/main/daemon/providers/lifecycle/testing/daemon-provider-census.test.ts index b4388b654eb..af8611dd90a 100644 --- a/src/main/daemon/providers/lifecycle/testing/daemon-provider-census.test.ts +++ b/src/main/daemon/providers/lifecycle/testing/daemon-provider-census.test.ts @@ -7,8 +7,7 @@ import { createAdapter } from '../../routing/testing/daemon-pty-router-test-fixt import { disconnectDaemon, listLiveDaemonSessions, - replaceDaemonProvider, - requestIdleDaemonRetirement + replaceDaemonProvider } from '../daemon-provider-state' import { PROTOCOL_VERSION } from '../../../protocol/daemon-protocol-version' @@ -16,11 +15,6 @@ afterEach(async () => { await disconnectDaemon() }) -it('reads a census without an installed daemon as unverifiable, never as empty', async () => { - await expect(listLiveDaemonSessions()).resolves.toBeNull() - await expect(requestIdleDaemonRetirement()).resolves.toEqual({ state: 'unverifiable' }) -}) - it('reads a census with an unanswered generation as unverifiable', async () => { const current = createAdapter('current', ['live-1'], undefined, PROTOCOL_VERSION) const legacy = createAdapter('legacy', [], undefined, PROTOCOL_VERSION) diff --git a/src/main/daemon/sessions/testing/reattach-snapshot.test.ts b/src/main/daemon/sessions/testing/reattach-snapshot.test.ts deleted file mode 100644 index 792bf13ef51..00000000000 --- a/src/main/daemon/sessions/testing/reattach-snapshot.test.ts +++ /dev/null @@ -1,39 +0,0 @@ -import '../../pty-subprocess/testing/mock-descendant-sweep' -import { describe, expect, it } from 'vitest' -import { HeadlessEmulator } from '../../emulation/headless-emulator' - -// This fixture assembles the payload locally; it does not exercise the adapter’s assembly. -function buildReattachPayload(snapshot: ReturnType) { - const isAltScreen = snapshot.modes.alternateScreen - const fullPayload = snapshot.scrollbackAnsi + snapshot.rehydrateSequences + snapshot.snapshotAnsi - return { - rehydrateSequences: snapshot.rehydrateSequences, - snapshotAnsi: snapshot.snapshotAnsi, - fullPayload, - isAlternateScreen: isAltScreen, - cols: snapshot.cols, - rows: snapshot.rows - } -} - -describe('reattach snapshot flow', () => { - describe('alternate-screen TUI (Codex style)', () => { - it('returns to preserved shell history after the reattached TUI exits', async () => { - const emulator = new HeadlessEmulator({ cols: 80, rows: 10 }) - await emulator.write('shell output before Codex\r\n$ codex') - await emulator.write('\x1b[?1049h\x1b[2J\x1b[HCodex TUI content') - const payload = buildReattachPayload(emulator.getSnapshot()) - emulator.dispose() - - const replay = new HeadlessEmulator({ cols: 80, rows: 10 }) - try { - await replay.write(payload.fullPayload) - expect(replay.getVisibleLines().join('\n')).toContain('Codex TUI content') - await replay.write('\x1b[?1049l') - expect(replay.getVisibleLines().join('\n')).toContain('shell output before Codex') - } finally { - replay.dispose() - } - }) - }) -}) diff --git a/src/main/ssh/system-transport/system-ssh-binary.test.ts b/src/main/ssh/system-transport/system-ssh-binary.test.ts index a3be418d2fc..9e061b4a1df 100644 --- a/src/main/ssh/system-transport/system-ssh-binary.test.ts +++ b/src/main/ssh/system-transport/system-ssh-binary.test.ts @@ -30,22 +30,6 @@ describe('findSystemSsh', () => { vi.unstubAllEnvs() }) - it('returns the first existing fixed ssh path', () => { - const platformSpy = vi.spyOn(process, 'platform', 'get').mockReturnValue('linux') - existsSyncMock.mockImplementation((path: string) => path === '/usr/bin/ssh') - - try { - expect(findSystemSsh()).toBe('/usr/bin/ssh') - } finally { - platformSpy.mockRestore() - } - }) - - it('returns null when no ssh binary is found', () => { - existsSyncMock.mockReturnValue(false) - expect(findSystemSsh()).toBeNull() - }) - it('finds a PATH-installed ssh.exe on Windows', () => { const platformSpy = vi.spyOn(process, 'platform', 'get').mockReturnValue('win32') vi.stubEnv('PATH', 'C:\\Git\\usr\\bin;C:\\Tools') @@ -96,11 +80,4 @@ describe('findSystemSsh', () => { platformSpy.mockRestore() } }) - - it('keeps an explicit system ssh override authoritative', () => { - vi.stubEnv('ORCA_SYSTEM_SSH_PATH', 'C:\\Custom\\ssh.exe') - - expect(findSystemSsh()).toBe('C:\\Custom\\ssh.exe') - expect(existsSyncMock).not.toHaveBeenCalled() - }) }) diff --git a/src/shared/github/projects/project-board-columns.test.ts b/src/shared/github/projects/project-board-columns.test.ts index 3fe4697b43d..573211ffe59 100644 --- a/src/shared/github/projects/project-board-columns.test.ts +++ b/src/shared/github/projects/project-board-columns.test.ts @@ -19,17 +19,6 @@ const STATUS_FIELD: GitHubProjectField = { ] } -const SPRINT_FIELD: GitHubProjectField = { - kind: 'iteration', - id: 'f_sprint', - name: 'Sprint', - dataType: 'ITERATION', - iterations: [ - { id: 'it_1', title: 'Sprint 1', startDate: '2026-08-24', duration: 14, completed: true }, - { id: 'it_2', title: 'Sprint 2', startDate: '2026-09-07', duration: 14, completed: false } - ] -} - function view(overrides: Partial): GitHubProjectView { return { id: 'PVTV_1', @@ -81,11 +70,6 @@ const statusValue = (optionId: string, name: string): GitHubProjectFieldValue => }) describe('resolveBoardColumnField', () => { - it('prefers the view-configured vertical group field', () => { - const v = view({ fields: [STATUS_FIELD], verticalGroupByFields: [SPRINT_FIELD] }) - expect(resolveBoardColumnField(v)).toBe(SPRINT_FIELD) - }) - it('ignores a non-select vertical field instead of building clear-only columns', () => { const textField: GitHubProjectField = { kind: 'field', diff --git a/src/shared/sidebar-list/feed/sidebar-inputs-feed-installer.test.ts b/src/shared/sidebar-list/feed/sidebar-inputs-feed-installer.test.ts index da55a03ba42..aa02993f6ff 100644 --- a/src/shared/sidebar-list/feed/sidebar-inputs-feed-installer.test.ts +++ b/src/shared/sidebar-list/feed/sidebar-inputs-feed-installer.test.ts @@ -141,24 +141,6 @@ describe('sidebar inputs installer', () => { expect(rowsOf(done)).toEqual({ order: { rankedIds: ['x', 'y'] } }) }) - it('reads a snapshot on a delta from elsewhere, a page from another batch, or unjoinable parts', () => { - const base = installed() - const read = sidebarInputsChanged(base.state, { generation: 'g1', revision: 5 }) - const mismatch = reply(read, page({ kind: 'delta', from: 2, revision: 5 })) - expect(mismatch.state.installed).toBe(base.state.installed) - - const broken = reply( - read, - page({ - kind: 'delta', - from: 3, - revision: 5, - domains: { rows: { upserts: {}, removals: [], parts: { a: '{"unterminated' } } } - }) - ) - expect(broken.state.installed).toBe(base.state.installed) - }) - it('re-reads from what is installed on a reset, and on a notice from a new generation', () => { const base = installed() const read = refreshSidebarInputs(base.state) diff --git a/src/shared/workspace-layout/commands/workspace-layout-default-tabs.test.ts b/src/shared/workspace-layout/commands/workspace-layout-default-tabs.test.ts deleted file mode 100644 index b088f7964b4..00000000000 --- a/src/shared/workspace-layout/commands/workspace-layout-default-tabs.test.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { describe, expect, it } from 'vitest' - -import { build, testContext, WS } from './workspace-layout-command.test-fixture' - -let next = 0 -/** The ids a window proposes for one default tab. */ -function ids() { - next += 1 - return { - tabId: `default-tab-${next}`, - leafId: `00000000-0000-4000-9000-${String(next).padStart(12, '0')}` - } -} - -describe('applyDefaultTabs', () => { - it('makes nothing once a workspace’s default tabs were applied', () => { - const ctx = testContext() - const { model, results } = build(ctx, [ - { type: 'applyDefaultTabs', workspace: WS, tabs: [{ ...ids(), title: 'Server' }] }, - { type: 'applyDefaultTabs', workspace: WS, tabs: [{ ...ids(), title: 'Again' }] } - ]) - expect(results[1]!.createdTabs).toEqual([]) - expect(model.workspaces[WS]!.tabs).toHaveLength(1) - }) -}) diff --git a/src/shared/workspace-layout/commands/workspace-layout-initial-surface.test.ts b/src/shared/workspace-layout/commands/workspace-layout-initial-surface.test.ts deleted file mode 100644 index 5408c078605..00000000000 --- a/src/shared/workspace-layout/commands/workspace-layout-initial-surface.test.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { applyLayoutCommand } from '../workspace-layout-commands' -import type { InitialSurfaceReason, LayoutCommand } from '../workspace-layout-command-types' -import { build, testContext, WS } from './workspace-layout-command.test-fixture' -import type { WorkspaceLayoutModel } from '../workspace-layout-model' - -const REASONS: InitialSurfaceReason[] = ['restore', 'activation'] - -function initialSurfaces(model: WorkspaceLayoutModel, initial: InitialSurfaceReason) { - const commands: LayoutCommand[] = [ - { type: 'createTerminalTab', workspace: WS, initial }, - { type: 'openAgentSessionTab', workspace: WS, sessionId: 's-1', agent: 'claude', initial } - ] - return commands.map((command) => { - const result = applyLayoutCommand(model, command, testContext()) - if (!result.ok) { - throw new Error(result.code) - } - return result.model.workspaces[WS]?.tabs.length ?? 0 - }) -} - -describe('initial surface', () => { - it('is not restored into a workspace a close emptied, but a user opening it gets one', () => { - const context = testContext() - const created = build(context, [{ type: 'createTerminalTab', workspace: WS }]) - const emptied = build( - context, - [{ type: 'closeTabs', workspace: WS, tabIds: [created.results[0]!.tabId!] }], - created.model - ).model - expect(emptied.legacy.terminalRowOwners[WS]).toBe(true) - expect(initialSurfaces(emptied, 'restore')).toEqual([0, 0]) - expect(initialSurfaces(emptied, 'activation')).toEqual([1, 1]) - }) - - it('is a no-op once the workspace has any tab, so two senders make one surface', () => { - const context = testContext() - const withEditor = build(context, [ - { type: 'openEditorTab', workspace: WS, fileId: '/repo/a.ts', contentType: 'editor' } - ]).model - for (const reason of REASONS) { - expect(initialSurfaces(withEditor, reason)).toEqual([1, 1]) - } - const once = build(context, [ - { type: 'createTerminalTab', workspace: WS, initial: 'activation' }, - { type: 'createTerminalTab', workspace: WS, initial: 'restore' }, - { - type: 'openAgentSessionTab', - workspace: WS, - sessionId: 's', - agent: 'claude', - initial: 'activation' - } - ]) - expect(once.model.workspaces[WS]!.tabs.map((tab) => tab.kind)).toEqual(['terminal']) - expect(once.results.slice(1)).toEqual([{}, {}]) - }) -}) diff --git a/src/shared/workspace-layout/commands/workspace-layout-move-tab-pin.test.ts b/src/shared/workspace-layout/commands/workspace-layout-move-tab-pin.test.ts deleted file mode 100644 index 38e6e5a12b2..00000000000 --- a/src/shared/workspace-layout/commands/workspace-layout-move-tab-pin.test.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { build, testContext, WS } from './workspace-layout-command.test-fixture' -import type { WorkspaceLayoutModel } from '../workspace-layout-model' - -function setup() { - const ctx = testContext() - const { model, results } = build(ctx, [ - { type: 'createTerminalTab', workspace: WS }, - { type: 'createTerminalTab', workspace: WS }, - { type: 'createTerminalTab', workspace: WS } - ]) - const [a, b, c] = results.map((result) => result!.tabId!) - const pinned = build( - ctx, - [ - { type: 'setTabProps', workspace: WS, tabId: a!, isPinned: true }, - { type: 'setTabProps', workspace: WS, tabId: b!, isPinned: true } - ], - model - ) - return { ctx, model: pinned.model, a: a!, b: b!, c: c! } -} - -const order = (model: WorkspaceLayoutModel) => model.workspaces[WS]!.groups[0]!.tabOrder -const pinOf = (model: WorkspaceLayoutModel, tabId: string) => - model.workspaces[WS]!.tabs.find((tab) => tab.id === tabId)?.isPinned === true - -describe('moveTab with a pin', () => { - it('pins the tab where the move puts it, without the pin moving it again', () => { - const { ctx, model, a, b, c } = setup() - const groupId = model.workspaces[WS]!.groups[0]!.id - - const moved = build( - ctx, - [{ type: 'moveTab', workspace: WS, tabId: c, toGroupId: groupId, index: 1, isPinned: true }], - model - ).model - - expect(order(moved)).toEqual([a, c, b]) - expect(pinOf(moved, c)).toBe(true) - }) - - it('unpins the tab where the move puts it', () => { - const { ctx, model, a, b, c } = setup() - const groupId = model.workspaces[WS]!.groups[0]!.id - const unpinnedB = build( - ctx, - [{ type: 'setTabProps', workspace: WS, tabId: b, isPinned: false }], - model - ).model - - const moved = build( - ctx, - [{ type: 'moveTab', workspace: WS, tabId: a, toGroupId: groupId, index: 1, isPinned: false }], - unpinnedB - ).model - - expect(order(moved)).toEqual([b, a, c]) - expect(pinOf(moved, a)).toBe(false) - }) - - it('a move without a pin leaves the pin as it was', () => { - const { ctx, model, a, b, c } = setup() - const groupId = model.workspaces[WS]!.groups[0]!.id - - const moved = build( - ctx, - [{ type: 'moveTab', workspace: WS, tabId: b, toGroupId: groupId, index: 0 }], - model - ).model - - expect(order(moved)).toEqual([b, a, c]) - expect(pinOf(moved, b)).toBe(true) - }) -}) diff --git a/src/shared/workspace-layout/commands/workspace-layout-ratio-commands.test.ts b/src/shared/workspace-layout/commands/workspace-layout-ratio-commands.test.ts index 4f986e1def2..7ebcdf77cae 100644 --- a/src/shared/workspace-layout/commands/workspace-layout-ratio-commands.test.ts +++ b/src/shared/workspace-layout/commands/workspace-layout-ratio-commands.test.ts @@ -1,5 +1,3 @@ -// Apply ratio intents to main’s tree; accept legacy whole-tree ratios only when pane/group identities still match. - import { describe, expect, it } from 'vitest' import { applyLayoutCommand } from '../workspace-layout-commands' import type { LayoutCommand } from '../workspace-layout-command-types' @@ -44,39 +42,6 @@ function refusal(model: WorkspaceLayoutModel, command: LayoutCommand) { } describe('divider ratios through main', () => { - it('setPaneRatios accepts divider sizes only', () => { - const { model, tabA, leafA, leafA2 } = setup() - const root = terminalTab(model, tabA).panes!.root! - if (root.type !== 'split') { - throw new Error('expected a split') - } - expect( - refusal(model, { - type: 'setPaneRatios', - workspace: WS, - tabId: tabA, - root: { ...root, ratio: 0.3 } - }) - ).toBe('applied') - const swapped = { - type: 'split' as const, - direction: 'vertical' as const, - first: { type: 'leaf' as const, leafId: leafA2 }, - second: { type: 'leaf' as const, leafId: leafA } - } - expect( - refusal(model, { type: 'setPaneRatios', workspace: WS, tabId: tabA, root: swapped }) - ).toBe('pane_structure_changed') - expect( - refusal(model, { - type: 'setPaneRatios', - workspace: WS, - tabId: tabA, - root: { type: 'leaf', leafId: leafA } - }) - ).toBe('pane_structure_changed') - }) - it('setPaneRatios applies divider intents to main’s own tree, and refuses a path with no split', () => { const { model, tabA } = setup() const applied = applyLayoutCommand( @@ -176,49 +141,4 @@ describe('divider ratios through main', () => { expect(terminalTab(model, tabA).panes!.root).toEqual(before) } }) - - it('applies a group intent only to the split it means', () => { - const { ctx, model, tabB } = setup() - const groupId = model.workspaces[WS]!.groups[0]!.id - // Use main’s ID minter to avoid creating a colliding group. - const split = applyLayoutCommand( - model, - { - type: 'splitGroup', - workspace: WS, - tabId: tabB, - besideGroupId: groupId, - direction: 'right' - }, - ctx - ) - if (!split.ok || split.model.workspaces[WS]!.groupLayout?.type !== 'split') { - throw new Error('expected a group split') - } - const layout = split.model.workspaces[WS]!.groupLayout - if (layout.type !== 'split' || layout.first.type !== 'leaf' || layout.second.type !== 'leaf') { - throw new Error('expected two groups side by side') - } - const meant = { - direction: layout.direction, - first: layout.first.groupId, - second: layout.second.groupId - } - expect( - refusal(split.model, { - type: 'setGroupRatios', - workspace: WS, - ratios: [{ path: '', ratio: 0.7, split: meant }] - }) - ).toBe('applied') - expect( - refusal(split.model, { - type: 'setGroupRatios', - workspace: WS, - ratios: [ - { path: '', ratio: 0.7, split: { ...meant, first: meant.second, second: meant.first } } - ] - }) - ).toBe('group_set_changed') - }) }) diff --git a/src/shared/workspace-layout/commands/workspace-layout-resume-record.test.ts b/src/shared/workspace-layout/commands/workspace-layout-resume-record.test.ts index e950eb1aa2e..3d999889976 100644 --- a/src/shared/workspace-layout/commands/workspace-layout-resume-record.test.ts +++ b/src/shared/workspace-layout/commands/workspace-layout-resume-record.test.ts @@ -61,35 +61,6 @@ describe('the sleep, wake and start commands on a resume record', () => { const record = (origin: Origin) => withOrigin(sleepingRecord(GIT_KEY, 'tab-shell', leaf(1)), origin) - it('keeps a recordOnly live capture as a resume record and a real sleep as a sleep', () => { - const context = testContext() - const { layout } = load(localDesktopSession()) - const sleep = (origin: Origin, recordOnly?: true) => ({ - type: 'sleep' as const, - workspace: GIT_KEY, - paneKeys: [shellPane], - records: [record(origin)], - ...(recordOnly ? { recordOnly } : {}) - }) - const live = build(context, [sleep('live', true)], layout).model - expect(leafOf(live, leaf(1))).toMatchObject({ resume: { origin: 'live' } }) - expect(leafOf(live, leaf(1))!.sleeping).toBeUndefined() - const slept = build(context, [sleep('worktree-sleep')], live).model - expect(leafOf(slept, leaf(1))).toMatchObject({ sleeping: { origin: 'worktree-sleep' } }) - expect(leafOf(slept, leaf(1))!.resume).toBeUndefined() - const recaptured = build(context, [sleep('quit', true)], slept).model - expect(leafOf(recaptured, leaf(1))).toMatchObject({ resume: { origin: 'quit' } }) - expect(leafOf(recaptured, leaf(1))!.sleeping).toBeUndefined() - // A recordOnly wake is how a running agent's record is dropped. - const cleared = build( - context, - [{ type: 'wake', workspace: GIT_KEY, paneKeys: [shellPane], recordOnly: true }], - recaptured - ) - expect(cleared.results[0]).toEqual({ woken: [shellPane] }) - expect(leafOf(cleared.model, leaf(1))!.resume).toBeUndefined() - }) - it('a waking start leaves a running agent alone: it keeps its resume record and is not started', () => { const context = testContext() const { layout } = load(localDesktopSession()) diff --git a/src/shared/workspace-layout/commands/workspace-layout-simulator-tab.test.ts b/src/shared/workspace-layout/commands/workspace-layout-simulator-tab.test.ts deleted file mode 100644 index a19ccb1c34c..00000000000 --- a/src/shared/workspace-layout/commands/workspace-layout-simulator-tab.test.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { applyLayoutCommand } from '../workspace-layout-commands' -import type { CommandOf } from '../workspace-layout-command-types' -import { build, testContext, WS } from './workspace-layout-command.test-fixture' - -const drawn = ( - fields: Partial> = {} -): CommandOf<'openSimulatorTab'> => ({ - type: 'openSimulatorTab', - workspace: WS, - tabId: 'sim-1', - ...fields -}) - -describe('a simulator tab a window drew', () => { - it('changes nothing when sent again, and refuses an id another tab holds', () => { - const ctx = testContext() - const { model, results } = build(ctx, [{ type: 'createTerminalTab', workspace: WS }, drawn()]) - const again = applyLayoutCommand(model, drawn(), ctx) - expect(again.ok && again.model).toEqual(model) - const taken = applyLayoutCommand(model, drawn({ tabId: results[0]!.tabId! }), ctx) - expect(taken.ok ? 'applied' : taken.code).toBe('tab_exists') - }) - - it('takes its place after the tab the window drew it beside', () => { - const ctx = testContext() - const { model, results } = build(ctx, [ - { type: 'createTerminalTab', workspace: WS }, - { type: 'createTerminalTab', workspace: WS } - ]) - const first = results[0]!.tabId! - const placed = build(ctx, [drawn({ afterTabId: first })], model).model - expect(placed.workspaces[WS]?.groups[0]?.tabOrder).toEqual([first, 'sim-1', results[1]!.tabId!]) - }) - - it('opens into the new split group the window made for it, and a close collapses it', () => { - const ctx = testContext() - const { model } = build(ctx, [{ type: 'createTerminalTab', workspace: WS }]) - const besideGroupId = model.workspaces[WS]!.groups[0]!.id - const split = build( - ctx, - [drawn({ groupId: 'g2', split: { besideGroupId, direction: 'right' } })], - model - ).model - expect(split.workspaces[WS]?.groupLayout).toMatchObject({ - type: 'split', - direction: 'horizontal', - first: { type: 'leaf', groupId: besideGroupId }, - second: { type: 'leaf', groupId: 'g2' } - }) - const closed = build( - ctx, - [{ type: 'closeTabs', workspace: WS, tabIds: ['sim-1'], force: true }], - split - ).model - expect(closed.workspaces[WS]?.groups.map((group) => group.id)).toEqual([besideGroupId]) - }) -})