test: remove narrow composer and workspace suites (#40654)

Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-11-09 22:01:11 -08:00
committed by GitHub
co-authored by OrcaWin
parent 69e1078675
commit 86ee16da9e
6 changed files with 21 additions and 207 deletions
File diff suppressed because one or more lines are too long
@@ -1,80 +0,0 @@
import { createElement } from 'react'
import { act, create, type ReactTestRenderer } from 'react-test-renderer'
import { afterEach, describe, expect, it, vi } from 'vitest'
import type {
AgentJournalRenderItem,
AgentJournalSubmission,
AgentJournalTurnLifecycle
} from '../../../../../src/shared/agent-session/journal/agent-session-journal-types'
import { agentJournalTurnBody } from '../../../../../src/shared/agent-session/lifecycle/agent-session-turn-record'
import { useMobileStructuredAgentTurnTiming } from './use-mobile-structured-agent-turn-timing'
// Skew the host clock by an hour so unconverted timestamp leakage is obvious.
const HOST_START = 3_600_000_000
const CLIENT_NOW = 12_345_000
function user(itemId: string, sequence: number): AgentJournalRenderItem {
return {
itemId,
revision: 0,
sequence,
observedAt: HOST_START + sequence,
body: { kind: 'message', role: 'user', blocks: [{ type: 'text', text: itemId }] }
}
}
function lifecycle(
turnId: string,
sequence: number,
turn: Omit<AgentJournalTurnLifecycle, 'turnId'>,
observedAt: number
): AgentJournalRenderItem {
return {
itemId: `lifecycle-${turnId}`,
revision: 1,
sequence,
observedAt,
body: agentJournalTurnBody({ turnId, ...turn })
}
}
type Timing = ReturnType<typeof useMobileStructuredAgentTurnTiming>
const NO_SUBMISSIONS: readonly AgentJournalSubmission[] = []
describe('useMobileStructuredAgentTurnTiming', () => {
let renderer: ReactTestRenderer | null = null
let timing: Timing | null = null
function Harness({
items,
submissions = NO_SUBMISSIONS,
turnId,
hostClock
}: {
items: readonly AgentJournalRenderItem[]
submissions?: readonly AgentJournalSubmission[]
turnId: string | null
hostClock?: { hostNow: number; receivedAt: number }
}): null {
timing = useMobileStructuredAgentTurnTiming({ items, submissions, hostClock }, turnId)
return null
}
afterEach(() => {
act(() => renderer?.unmount())
renderer = null
timing = null
vi.useRealTimers()
})
it('leaves the anchor null when an older host records no start', () => {
vi.useFakeTimers()
vi.setSystemTime(CLIENT_NOW)
const items = [user('u1', 1), lifecycle('t1', 2, { state: 'running' }, HOST_START)]
act(() => {
renderer = create(createElement(Harness, { items, turnId: 't1' }))
})
expect(timing?.workingStartedAt).toBeNull()
expect(timing?.settledTurns.size).toBe(0)
})
})
@@ -1,11 +1,7 @@
import { describe, expect, it } from 'vitest'
import type { AutomationHostCatalogEntry } from '../hosts/automation-host-catalog-types'
import {
externalAutomationProbeOwners,
externalAutomationScopeGateFromError,
parseExternalAutomationScopeCode
} from './external-automation-scope-gating'
import { externalAutomationProbeOwners } from './external-automation-scope-gating'
function entry(overrides: Partial<AutomationHostCatalogEntry> = {}): AutomationHostCatalogEntry {
return {
@@ -41,10 +37,3 @@ describe('external automation scope gating', () => {
])
})
})
describe('engine scope errors', () => {
it('leaves unrelated failures alone so they are not relabelled as scope limits', () => {
expect(externalAutomationScopeGateFromError(new Error('socket hang up'))).toBeNull()
expect(parseExternalAutomationScopeCode(null)).toBeNull()
})
})
@@ -1,57 +0,0 @@
// @vitest-environment happy-dom
import { act, cleanup, renderHook } from '@testing-library/react'
import { afterEach, describe, expect, it, vi } from 'vitest'
import { useQuickSubmitAction } from './quick-submit-action'
afterEach(cleanup)
type QuickSubmitActionInput = Parameters<typeof useQuickSubmitAction>[0]
function renderQuickSubmit(overrides: Partial<QuickSubmitActionInput>) {
// oxlint-disable-next-line typescript/consistent-type-assertions -- SAFETY: the omitted repo and target fields are not read before the reveal; the real store starts with no pending creations.
const input = {
effectiveLinkedPR: null,
executeQuickCreation: vi.fn(),
fallbackCreatureName: 'otter',
isProjectGroupTarget: false,
isSubmissionCancelled: () => false,
linkedPR: null,
linkedWorkItem: null,
name: 'feature',
onCreated: vi.fn(),
parsedLinkedIssueNumber: null,
repoId: 'repo-1',
requiresExplicitSetupChoice: false,
resolvePendingSmartGitHubSubmit: vi.fn(),
selectedRepo: { id: 'repo-1', path: '/repo' },
selectedRepoRequiresConnection: false,
selectedTargetNeedsVisibleHost: false,
selectedWorkspaceTarget: { status: 'none' },
revealSetupChoice: vi.fn(),
setCreateError: vi.fn(),
setCreating: vi.fn(),
setupDecision: null,
showProjectRequiredError: vi.fn(),
sourceIntentBlocksCreate: false,
sparseError: null,
submitFolderTarget: vi.fn(),
taskSourceContext: null,
telemetrySource: 'sidebar',
...overrides
} as unknown as QuickSubmitActionInput
const { result } = renderHook(() => useQuickSubmitAction(input))
return { input, submitQuick: result.current.submitQuick }
}
describe('useQuickSubmitAction setup choice', () => {
it('reveals the hidden Run/Skip choice instead of refusing a submit with no decision', async () => {
const { input, submitQuick } = renderQuickSubmit({ requiresExplicitSetupChoice: true })
await act(() => submitQuick(null))
expect(input.revealSetupChoice).toHaveBeenCalledTimes(1)
expect(input.setCreating).not.toHaveBeenCalled()
expect(input.executeQuickCreation).not.toHaveBeenCalled()
})
})
@@ -1,26 +0,0 @@
import { describe, expect, it } from 'vitest'
import { showsFloatingRightSidebarToggle } from './right-sidebar-visibility'
describe('showsFloatingRightSidebarToggle', () => {
it('keeps a way to reopen the closed sidebar during workspace creation', () => {
expect(
showsFloatingRightSidebarToggle({
activeView: 'terminal',
workspaceChromeActive: false,
creationLayoutActive: true,
rightSidebarOpen: false
})
).toBe(true)
})
it('leaves the open sidebar to its own close button', () => {
expect(
showsFloatingRightSidebarToggle({
activeView: 'terminal',
workspaceChromeActive: false,
creationLayoutActive: true,
rightSidebarOpen: true
})
).toBe(false)
})
})
@@ -1,17 +0,0 @@
import { describe, expect, it, vi } from 'vitest'
import { restoreSourcePaneOptions } from './agent-session-ensure-provider-session'
vi.mock('../../../rpc/compatibility/runtime-capability-proof', () => ({
runtimeEnvironmentSupportsCapability: async () => true
}))
const LEAF = '11111111-1111-4111-8111-111111111111'
// The host keys its saved notes by its own tab, never the desktop mirror's.
describe('a saved restore source pane sent to its host', () => {
it('names the host tab, not the mirror tab', async () => {
expect(await restoreSourcePaneOptions('env-1', `web-terminal-host-tab:${LEAF}`)).toEqual({
restoreSourcePaneKey: `host-tab:${LEAF}`
})
})
})