mirror of
https://github.com/stablyai/orca.git
synced 2026-11-14 01:47:24 +00:00
test: remove 18 low-value renderer and web tests (#37809)
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -11450,7 +11450,6 @@
|
||||
"src/renderer/src/store/slices/worktrees-multiple-attachments.test.ts": 1132,
|
||||
"src/renderer/src/store/slices/worktrees-pending-creation-state.test.ts": 1132,
|
||||
"src/renderer/src/store/slices/worktrees-purge-terminal-state.test.ts": 1133,
|
||||
"src/renderer/src/store/slices/worktrees-recent-stamp-switch-on.test.ts": 1141,
|
||||
"src/renderer/src/store/slices/worktrees-remote-runtime-create.test.ts": 1244,
|
||||
"src/renderer/src/store/slices/worktrees-remote-runtime-removal.test.ts": 1227,
|
||||
"src/renderer/src/store/slices/worktrees-removal-state-cleanup.test.ts": 1229,
|
||||
@@ -11482,7 +11481,6 @@
|
||||
"src/renderer/src/store/terminals/terminal-no-op-subscriber.test.ts": 1763,
|
||||
"src/renderer/src/store/terminals/terminal-startup-queue-restart.test.ts": 1895,
|
||||
"src/renderer/src/store/terminals/terminal-tab-close-intent.test.ts": 1945,
|
||||
"src/renderer/src/store/terminals/terminal-tab-mirrored-id.test.ts": 1662,
|
||||
"src/renderer/src/store/terminals/workspace-terminal-placeholders.test.ts": 302,
|
||||
"src/renderer/src/store/use-runtime-status-view.test.tsx": 1979,
|
||||
"src/renderer/src/store/workspace-layout-cache.test.ts": 63,
|
||||
@@ -11491,11 +11489,9 @@
|
||||
"src/renderer/src/store/worktree-diff-comments-selector.test.ts": 346,
|
||||
"src/renderer/src/store/worktree-host-collision-index.test.ts": 1875,
|
||||
"src/renderer/src/web/preload-api/web-agent-session-attachment-upload.test.ts": 1588,
|
||||
"src/renderer/src/web/preload-api/web-ai-vault-search-compat.test.ts": 306,
|
||||
"src/renderer/src/web/preload-api/web-chat-permission-normalization.test.ts": 293,
|
||||
"src/renderer/src/web/preload-api/web-filesystem-api-connection-pin.test.ts": 509,
|
||||
"src/renderer/src/web/preload-api/web-runtime-calls-connection-pin.test.ts": 51,
|
||||
"src/renderer/src/web/preload-api/web-shell-attachment-picker.test.ts": 201,
|
||||
"src/renderer/src/web/preload-api/web-ui-compact-notice.test.ts": 1192,
|
||||
"src/renderer/src/web/preload-api/web-ui-explorer-root.test.ts": 880,
|
||||
"src/renderer/src/web/web-clipboard-copy-terminal-selection.test.ts": 176,
|
||||
|
||||
@@ -27,13 +27,4 @@ describe('workspace port-scan surface actions', () => {
|
||||
expect(countNotifications(() => setRefreshing(false))).toBe(0)
|
||||
expect(useAppStore.getState().workspacePortScanRefreshing).toBe(false)
|
||||
})
|
||||
|
||||
it('still notifies once on a real transition, in both directions', () => {
|
||||
const setRefreshing = useAppStore.getState().setWorkspacePortScanRefreshing
|
||||
|
||||
expect(countNotifications(() => setRefreshing(true))).toBe(1)
|
||||
expect(useAppStore.getState().workspacePortScanRefreshing).toBe(true)
|
||||
expect(countNotifications(() => setRefreshing(false))).toBe(1)
|
||||
expect(useAppStore.getState().workspacePortScanRefreshing).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -417,25 +417,6 @@ describe('fetchWorktrees', () => {
|
||||
await rename
|
||||
})
|
||||
|
||||
it('keeps the last known worktree list when a refresh transiently returns empty', async () => {
|
||||
const store = createTestStore()
|
||||
const existing = makeWorktree({ id: 'repo1::/path/wt1', repoId: 'repo1', path: '/path/wt1' })
|
||||
|
||||
mockApi.worktrees.listDetected.mockResolvedValueOnce(
|
||||
makeDetectedResult('repo1', [], {
|
||||
authoritative: false,
|
||||
source: 'metadata-fallback'
|
||||
})
|
||||
)
|
||||
store.setState({ worktreesByRepo: { repo1: [existing] }, sortEpoch: 7 } as Partial<AppState>)
|
||||
|
||||
const result = await store.getState().fetchWorktrees('repo1')
|
||||
|
||||
expect(store.getState().worktreesByRepo.repo1).toEqual([existing])
|
||||
expect(store.getState().sortEpoch).toBe(7)
|
||||
expect(result).toBe(false)
|
||||
})
|
||||
|
||||
it('keeps the scanned rows and their tabs when a stopped WSL distro returns stored rows', async () => {
|
||||
const store = createTestStore()
|
||||
const scanned = makeWorktree({
|
||||
|
||||
@@ -145,50 +145,6 @@ describe('fetchWorktrees', () => {
|
||||
])
|
||||
})
|
||||
|
||||
it('fetches the requested host when duplicate repo ids exist', async () => {
|
||||
const store = createTestStore()
|
||||
const localWorktree = makeWorktree({
|
||||
id: 'same-repo::/local/wt',
|
||||
repoId: 'same-repo',
|
||||
path: '/local/wt'
|
||||
})
|
||||
store.setState({
|
||||
settings: { activeRuntimeEnvironmentId: 'env-1' } as never,
|
||||
repos: [
|
||||
{
|
||||
id: 'same-repo',
|
||||
path: '/local/repo',
|
||||
displayName: 'Local',
|
||||
badgeColor: '#000',
|
||||
addedAt: 0,
|
||||
executionHostId: 'local'
|
||||
},
|
||||
{
|
||||
id: 'same-repo',
|
||||
path: '/remote/repo',
|
||||
displayName: 'Runtime',
|
||||
badgeColor: '#111',
|
||||
addedAt: 1,
|
||||
executionHostId: 'runtime:env-1'
|
||||
}
|
||||
]
|
||||
} as Partial<AppState>)
|
||||
mockApi.worktrees.listDetected.mockResolvedValueOnce(
|
||||
makeDetectedResult('same-repo', [localWorktree])
|
||||
)
|
||||
|
||||
await store.getState().fetchWorktrees('same-repo', { executionHostId: 'local' })
|
||||
|
||||
expect(mockApi.worktrees.listDetected).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
repoId: 'same-repo',
|
||||
executionHostId: 'local'
|
||||
})
|
||||
)
|
||||
expect(runtimeEnvironmentCall).not.toHaveBeenCalled()
|
||||
expect(store.getState().worktreesByRepo['same-repo']).toEqual([localWorktree])
|
||||
})
|
||||
|
||||
it('honors an explicit runtime owner before the repo catalog is hydrated', async () => {
|
||||
const store = createTestStore()
|
||||
const remote = makeWorktree({
|
||||
@@ -337,42 +293,6 @@ describe('fetchWorktrees', () => {
|
||||
expect(store.getState().worktreesByRepo['repo-missing']).toBeUndefined()
|
||||
})
|
||||
|
||||
it('stamps remote runtime worktrees with the owning repo runtime host', async () => {
|
||||
const store = createTestStore()
|
||||
// Why: a remote runtime returns worktrees from its own perspective, so their hostId arrives as the default "local".
|
||||
const remote = makeWorktree({
|
||||
id: 'repo-remote::/remote/wt1',
|
||||
repoId: 'repo-remote',
|
||||
path: '/remote/wt1',
|
||||
branch: 'refs/heads/remote',
|
||||
hostId: 'local'
|
||||
})
|
||||
store.setState({
|
||||
repos: [
|
||||
{
|
||||
id: 'repo-remote',
|
||||
path: '/home/dvic/src/omarchy-dotfiles',
|
||||
displayName: 'omarchy-dotfiles',
|
||||
badgeColor: '#000',
|
||||
addedAt: 0,
|
||||
executionHostId: 'runtime:env-1'
|
||||
}
|
||||
]
|
||||
})
|
||||
runtimeEnvironmentCall.mockResolvedValue({
|
||||
id: 'rpc-1',
|
||||
ok: true,
|
||||
result: makeDetectedResult('repo-remote', [remote]),
|
||||
_meta: { runtimeId: 'runtime-remote' }
|
||||
})
|
||||
|
||||
await store.getState().fetchWorktrees('repo-remote', { forceLocalOwner: true })
|
||||
|
||||
expect(store.getState().worktreesByRepo['repo-remote']).toEqual([
|
||||
{ ...remote, hostId: 'runtime:env-1', runtimeOwnerEnvironmentId: 'env-1' }
|
||||
])
|
||||
})
|
||||
|
||||
it('rejects a pre-reconnect runtime listing after a newer generation publishes', async () => {
|
||||
const store = createTestStore()
|
||||
const stale = makeWorktree({
|
||||
|
||||
@@ -6,7 +6,6 @@ import { TEST_SSH_AUTHORITY, makeDetectedResult } from './worktrees-detected-lis
|
||||
import { makeWorktree } from './worktrees-slice-test-fixtures'
|
||||
import {
|
||||
createTestStore,
|
||||
forgetRemovedForExecutionHostMock,
|
||||
listKnownForExecutionHostMock,
|
||||
mockApi,
|
||||
resetRemoteRuntimeMocks,
|
||||
@@ -299,55 +298,6 @@ describe('fetchWorktrees', () => {
|
||||
expect(store.getState().worktreesByRepo[sshRepo.id]).toEqual([live])
|
||||
})
|
||||
|
||||
it('retires persisted metadata for worktrees an authoritative SSH scan proved gone', async () => {
|
||||
const store = createTestStore()
|
||||
const sshRepo = {
|
||||
id: 'repo-ssh',
|
||||
path: '/home/orca/repo',
|
||||
displayName: 'SSH Repo',
|
||||
badgeColor: '#000',
|
||||
addedAt: 0,
|
||||
connectionId: 'ssh-1'
|
||||
}
|
||||
const live = makeWorktree({
|
||||
id: 'repo-ssh::/home/orca/live',
|
||||
repoId: 'repo-ssh',
|
||||
path: '/home/orca/live',
|
||||
hostId: 'ssh:ssh-1'
|
||||
})
|
||||
const deletedOnRemote = makeWorktree({
|
||||
id: 'repo-ssh::/home/orca/deleted',
|
||||
repoId: 'repo-ssh',
|
||||
path: '/home/orca/deleted'
|
||||
})
|
||||
const connectedStates = createTestStore().getState().sshConnectionStates
|
||||
listKnownForExecutionHostMock.mockResolvedValueOnce({
|
||||
status: 'complete',
|
||||
repoId: sshRepo.id,
|
||||
executionHostId: 'ssh:ssh-1',
|
||||
result: makeDetectedResult(sshRepo.id, [deletedOnRemote], {
|
||||
authoritative: false,
|
||||
source: 'metadata-fallback'
|
||||
})
|
||||
})
|
||||
store.setState({ repos: [sshRepo], sshConnectionStates: new Map() } as Partial<AppState>)
|
||||
await store.getState().fetchWorktrees(sshRepo.id)
|
||||
|
||||
// The non-authoritative fallback saw the same absence but must not act on it.
|
||||
expect(forgetRemovedForExecutionHostMock).not.toHaveBeenCalled()
|
||||
|
||||
worktreeListMock.mockResolvedValueOnce([live])
|
||||
store.setState({ sshConnectionStates: connectedStates } as Partial<AppState>)
|
||||
await store.getState().fetchWorktrees(sshRepo.id)
|
||||
|
||||
// Why: the renderer's suppression memory dies with the reload, so the metadata itself has to go.
|
||||
expect(forgetRemovedForExecutionHostMock).toHaveBeenCalledExactlyOnceWith({
|
||||
repoId: sshRepo.id,
|
||||
executionHostId: 'ssh:ssh-1',
|
||||
worktreeIds: [deletedOnRemote.id]
|
||||
})
|
||||
})
|
||||
|
||||
it('skips the metadata fallback entirely for authoritative-only callers', async () => {
|
||||
const store = createTestStore()
|
||||
const sshRepo = {
|
||||
|
||||
@@ -110,50 +110,6 @@ describe('fetchWorktrees', () => {
|
||||
expect(store.getState().sortEpoch).toBe(8)
|
||||
})
|
||||
|
||||
it('keeps pr-checks and plugin panel tabs for surviving worktrees after an authoritative purge', async () => {
|
||||
const store = createTestStore()
|
||||
const removed = makeWorktree({
|
||||
id: 'repo1::/path/removed',
|
||||
repoId: 'repo1',
|
||||
path: '/path/removed'
|
||||
})
|
||||
const surviving = makeWorktree({
|
||||
id: 'repo1::/path/surviving',
|
||||
repoId: 'repo1',
|
||||
path: '/path/surviving'
|
||||
})
|
||||
|
||||
worktreeListMock.mockResolvedValue([surviving])
|
||||
store.setState({
|
||||
worktreesByRepo: { repo1: [removed, surviving] },
|
||||
sortEpoch: 7,
|
||||
rightSidebarTabByWorktree: {
|
||||
[removed.id]: 'search' as never,
|
||||
[surviving.id]: 'pr-checks' as never
|
||||
},
|
||||
rightSidebarExplorerViewByWorktree: {
|
||||
[removed.id]: 'search',
|
||||
[surviving.id]: 'files'
|
||||
}
|
||||
} as Partial<AppState>)
|
||||
|
||||
await store.getState().fetchWorktrees('repo1')
|
||||
|
||||
// pr-checks is not dropped like unknown values; it survives the purge.
|
||||
expect(store.getState().rightSidebarTabByWorktree).toEqual({ [surviving.id]: 'pr-checks' })
|
||||
|
||||
// A shape-valid plugin panel tab also survives the purge.
|
||||
store.setState({
|
||||
rightSidebarTabByWorktree: {
|
||||
[surviving.id]: 'plugin:orca-samples.my-plugin/dashboard' as never
|
||||
}
|
||||
} as Partial<AppState>)
|
||||
await store.getState().fetchWorktrees('repo1')
|
||||
expect(store.getState().rightSidebarTabByWorktree).toEqual({
|
||||
[surviving.id]: 'plugin:orca-samples.my-plugin/dashboard'
|
||||
})
|
||||
})
|
||||
|
||||
it('retains hidden state until an authoritative refresh removes the worktree', async () => {
|
||||
const store = createTestStore()
|
||||
const visible = makeWorktree({
|
||||
@@ -314,42 +270,6 @@ describe('fetchWorktrees', () => {
|
||||
expect(hasDismissedHugeRepoWarning(beginHugeRepoWarningProbe(hidden))).toBe(false)
|
||||
})
|
||||
|
||||
it('refreshes only repos owned by the changed visibility-default host', async () => {
|
||||
const store = createTestStore()
|
||||
mockApi.worktrees.listDetected.mockImplementationOnce(async (args) =>
|
||||
qualifyDetectedResult(args, makeDetectedResult(args.repoId, []))
|
||||
)
|
||||
store.setState({
|
||||
repos: [
|
||||
{
|
||||
id: 'local-repo',
|
||||
path: '/local',
|
||||
displayName: 'Local',
|
||||
badgeColor: '#000',
|
||||
addedAt: 0,
|
||||
executionHostId: 'local'
|
||||
},
|
||||
{
|
||||
id: 'runtime-repo',
|
||||
path: '/remote',
|
||||
displayName: 'Remote',
|
||||
badgeColor: '#000',
|
||||
addedAt: 0,
|
||||
executionHostId: 'runtime:env-1'
|
||||
}
|
||||
],
|
||||
hasHydratedWorktreePurge: true
|
||||
} as Partial<AppState>)
|
||||
|
||||
await store.getState().fetchAllWorktrees({ visibilityOwnerHostId: 'local' })
|
||||
|
||||
expect(mockApi.worktrees.listDetected).toHaveBeenCalledOnce()
|
||||
expect(mockApi.worktrees.listDetected).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ repoId: 'local-repo', executionHostId: 'local' })
|
||||
)
|
||||
expect(mockApi.runtime.call).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('purges session-only tab keys after an authoritative refresh', async () => {
|
||||
const store = createTestStore()
|
||||
const deleted = makeWorktree({
|
||||
|
||||
@@ -186,50 +186,6 @@ describe('worktree lineage state', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('stamps the owning runtime host onto worktrees returned by a remote lineage update', async () => {
|
||||
const store = createTestStore()
|
||||
const lineage = makeLineage({
|
||||
worktreeId: 'repo-remote::/remote/child',
|
||||
parentWorktreeId: 'repo-remote::/remote/parent'
|
||||
})
|
||||
const child = makeWorktree({
|
||||
id: lineage.worktreeId,
|
||||
repoId: 'repo-remote',
|
||||
path: '/remote/child'
|
||||
})
|
||||
// Why: the remote returns the updated worktree from its own perspective, so it arrives with the default local host.
|
||||
const updatedChild = { ...child, hostId: 'local' as const, lineage }
|
||||
store.setState({
|
||||
repos: [
|
||||
{
|
||||
id: 'repo-remote',
|
||||
path: '/home/dvic/src/omarchy-dotfiles',
|
||||
displayName: 'omarchy-dotfiles',
|
||||
badgeColor: '#000',
|
||||
addedAt: 0,
|
||||
executionHostId: 'runtime:env-1'
|
||||
}
|
||||
],
|
||||
worktreesByRepo: { 'repo-remote': [child] }
|
||||
} as Partial<AppState>)
|
||||
runtimeEnvironmentCall.mockResolvedValueOnce({
|
||||
id: 'rpc-remote-lineage',
|
||||
ok: true,
|
||||
result: { worktree: updatedChild },
|
||||
_meta: { runtimeId: 'runtime-remote' }
|
||||
})
|
||||
|
||||
await store.getState().updateWorktreeLineage(lineage.worktreeId, {
|
||||
parentWorktreeId: lineage.parentWorktreeId
|
||||
})
|
||||
|
||||
expect(store.getState().worktreesByRepo['repo-remote']?.[0]).toEqual({
|
||||
...updatedChild,
|
||||
hostId: 'runtime:env-1',
|
||||
runtimeOwnerEnvironmentId: 'env-1'
|
||||
})
|
||||
})
|
||||
|
||||
it('assigns a parent through the worktree owner runtime when host-stamped', async () => {
|
||||
const store = createTestStore()
|
||||
const lineage = makeLineage()
|
||||
|
||||
@@ -170,40 +170,6 @@ describe('worktree remote runtime mutations', () => {
|
||||
expect(mockApi.worktrees.forceDeletePreservedBranch).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('persists SSH-owned worktree metadata through local IPC even when a runtime is focused', async () => {
|
||||
const store = createTestStore()
|
||||
const wt = makeWorktree({
|
||||
id: 'repo-ssh::/home/orca/wt1',
|
||||
repoId: 'repo-ssh',
|
||||
path: '/home/orca/wt1',
|
||||
hostId: 'ssh:ssh-1'
|
||||
})
|
||||
store.setState({
|
||||
settings: { activeRuntimeEnvironmentId: 'env-1' } as never,
|
||||
repos: [
|
||||
{
|
||||
id: 'repo-ssh',
|
||||
path: '/home/orca/repo',
|
||||
displayName: 'SSH Repo',
|
||||
badgeColor: '#000',
|
||||
addedAt: 0,
|
||||
connectionId: 'ssh-1'
|
||||
}
|
||||
],
|
||||
worktreesByRepo: { 'repo-ssh': [wt] }
|
||||
} as Partial<AppState>)
|
||||
|
||||
await store.getState().updateWorktreeMeta(wt.id, { comment: 'ssh note' })
|
||||
|
||||
expect(mockApi.worktrees.updateMeta).toHaveBeenCalledWith({
|
||||
worktreeId: wt.id,
|
||||
executionHostId: 'ssh:ssh-1',
|
||||
updates: expect.objectContaining({ comment: 'ssh note' })
|
||||
})
|
||||
expect(runtimeEnvironmentCall).not.toHaveBeenCalled()
|
||||
expect(store.getState().worktreesByRepo['repo-ssh'][0]?.comment).toBe('ssh note')
|
||||
})
|
||||
|
||||
it('clears pending first-agent rename when the title is updated', async () => {
|
||||
const store = createTestStore()
|
||||
const wt = makeWorktree({
|
||||
|
||||
@@ -59,20 +59,6 @@ describe('pending worktree creation state', () => {
|
||||
resetRemoteRuntimeMocks()
|
||||
})
|
||||
|
||||
it('removePendingWorktreeCreation clears the active surface only when it points at the removed entry', () => {
|
||||
const store = createTestStore()
|
||||
store.getState().beginPendingWorktreeCreation(makePendingCreation('c1'))
|
||||
store.getState().beginPendingWorktreeCreation(makePendingCreation('c2'))
|
||||
// c2 is active now; removing the background c1 must not steal the surface.
|
||||
store.getState().removePendingWorktreeCreation('c1')
|
||||
|
||||
expect(store.getState().pendingWorktreeCreations.c1).toBeUndefined()
|
||||
expect(store.getState().activePendingCreationId).toBe('c2')
|
||||
|
||||
store.getState().removePendingWorktreeCreation('c2')
|
||||
expect(store.getState().activePendingCreationId).toBeNull()
|
||||
})
|
||||
|
||||
it('removePendingWorktreeCreation cleans up a provisioned-root setup and VM runtime', async () => {
|
||||
const store = createTestStore()
|
||||
const deleteProjectHostSetup = vi.mocked(store.getState().deleteProjectHostSetup)
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { folderWorkspaceKey } from '../../../../shared/workspace-scope'
|
||||
import { makeFolderWorkspace, makeWorktree } from './worktrees-slice-test-fixtures'
|
||||
import {
|
||||
createTestStore,
|
||||
mockApi,
|
||||
resetRemoteRuntimeMocks,
|
||||
resetWorktreeSliceModuleMemory
|
||||
} from './worktrees-slice-test-harness'
|
||||
|
||||
vi.mock('../../../../shared/sidebar-inputs-switch', () => ({ ORCA_SIDEBAR_INPUTS_IS_MAIN: true }))
|
||||
|
||||
vi.mock('sonner', () => ({
|
||||
toast: {
|
||||
warning: vi.fn(),
|
||||
info: vi.fn(),
|
||||
success: vi.fn(),
|
||||
error: vi.fn(),
|
||||
dismiss: vi.fn()
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('@/components/worktree-base-fallback-notice', () => ({
|
||||
requestWorktreeBaseFallbackNotice: vi.fn()
|
||||
}))
|
||||
|
||||
beforeEach(resetWorktreeSliceModuleMemory)
|
||||
|
||||
// With the switch on, the owning host writes every Recent stamp and the unread flag; the window
|
||||
// writes neither.
|
||||
describe('window-side Recent stamps with the sidebar-inputs switch on', () => {
|
||||
const wt = makeWorktree({
|
||||
id: 'repo1::/path/wt1',
|
||||
repoId: 'repo1',
|
||||
path: '/path/wt1',
|
||||
lastActivityAt: 5
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
resetRemoteRuntimeMocks()
|
||||
})
|
||||
|
||||
function storeWith() {
|
||||
const store = createTestStore()
|
||||
store.setState({ worktreesByRepo: { repo1: [wt] } })
|
||||
return store
|
||||
}
|
||||
|
||||
const lastActivityAt = (store: ReturnType<typeof createTestStore>) =>
|
||||
store.getState().worktreesByRepo.repo1[0].lastActivityAt
|
||||
|
||||
const persistedStamp = () =>
|
||||
mockApi.worktrees.updateMeta.mock.calls.some(
|
||||
([args]: [{ updates: Record<string, unknown> }]) => 'lastActivityAt' in args.updates
|
||||
)
|
||||
|
||||
it('a terminal start or exit writes no stamp', () => {
|
||||
const store = storeWith()
|
||||
store.getState().bumpWorktreeActivity(wt.id)
|
||||
expect(lastActivityAt(store)).toBe(5)
|
||||
expect(persistedStamp()).toBe(false)
|
||||
})
|
||||
|
||||
it('a comment edit writes no stamp', async () => {
|
||||
const store = storeWith()
|
||||
await store.getState().updateWorktreeMeta(wt.id, { comment: 'note' })
|
||||
expect(store.getState().worktreesByRepo.repo1[0].comment).toBe('note')
|
||||
expect(lastActivityAt(store)).toBe(5)
|
||||
expect(persistedStamp()).toBe(false)
|
||||
})
|
||||
|
||||
it('a folder workspace’s terminal activity and finish write no stamp and no flag', async () => {
|
||||
const store = createTestStore()
|
||||
const folder = makeFolderWorkspace({ id: 'folder-1', lastActivityAt: 5 })
|
||||
store.setState({ folderWorkspaces: [folder], projectGroups: [] })
|
||||
store.getState().bumpWorktreeActivity(folderWorkspaceKey(folder.id))
|
||||
store.getState().markAgentAttentionUnread({
|
||||
workspaceId: folderWorkspaceKey(folder.id),
|
||||
subjectKey: null,
|
||||
groupId: null,
|
||||
reason: 'agent-completion'
|
||||
})
|
||||
await new Promise((resolve) => setTimeout(resolve, 0))
|
||||
expect(store.getState().folderWorkspaces[0]).toMatchObject({
|
||||
isUnread: false,
|
||||
lastActivityAt: 5
|
||||
})
|
||||
const folderWrites = vi.mocked(store.getState().updateFolderWorkspace).mock.calls
|
||||
expect(
|
||||
folderWrites.some(([, updates]) => 'lastActivityAt' in updates || 'isUnread' in updates)
|
||||
).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -258,78 +258,6 @@ describe('worktree remote runtime mutations', () => {
|
||||
expect(runtimeEnvironmentCall).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('passes startup commands through remote runtime worktree creation', async () => {
|
||||
const store = createRepoTestStore()
|
||||
const wt = makeWorktree({
|
||||
id: 'repo1::/path/agent-startup',
|
||||
repoId: 'repo1',
|
||||
path: '/path/agent-startup'
|
||||
})
|
||||
runtimeEnvironmentCall.mockResolvedValue({
|
||||
id: 'rpc-create',
|
||||
ok: true,
|
||||
result: { worktree: wt },
|
||||
_meta: { runtimeId: 'runtime-remote' }
|
||||
})
|
||||
store.setState({
|
||||
settings: { activeRuntimeEnvironmentId: 'env-1' } as never,
|
||||
worktreesByRepo: { repo1: [] }
|
||||
} as Partial<AppState>)
|
||||
seedRepoHost(store, 'runtime:env-1')
|
||||
|
||||
await store
|
||||
.getState()
|
||||
.createWorktree(
|
||||
'repo1',
|
||||
'agent-startup',
|
||||
undefined,
|
||||
'skip',
|
||||
undefined,
|
||||
'sidebar',
|
||||
'Launch agent',
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
'codex',
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
{
|
||||
command: "codex 'summarize repo'",
|
||||
env: { ORCA_AGENT_MODE: 'direct' },
|
||||
launchConfig: {
|
||||
agentCommand: 'codex',
|
||||
agentArgs: '--model gpt-5',
|
||||
agentEnv: { ORCA_AGENT_MODE: 'direct' }
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
expect(runtimeEnvironmentCall).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
method: 'worktree.create',
|
||||
params: expect.objectContaining({
|
||||
repo: 'repo1',
|
||||
name: 'agent-startup',
|
||||
setupDecision: 'skip',
|
||||
telemetrySource: 'sidebar',
|
||||
displayName: 'Launch agent',
|
||||
createdWithAgent: 'codex',
|
||||
startupCommand: "codex 'summarize repo'",
|
||||
startupEnv: { ORCA_AGENT_MODE: 'direct' },
|
||||
startupLaunchConfig: {
|
||||
agentCommand: 'codex',
|
||||
agentArgs: '--model gpt-5',
|
||||
agentEnv: { ORCA_AGENT_MODE: 'direct' }
|
||||
},
|
||||
activate: true
|
||||
})
|
||||
})
|
||||
)
|
||||
})
|
||||
|
||||
it('retries a suffixed branchNameOverride when runtime create reports a branch conflict', async () => {
|
||||
const store = createRepoTestStore()
|
||||
const wt = makeWorktree({
|
||||
|
||||
@@ -217,44 +217,6 @@ describe('worktree remote runtime mutations', () => {
|
||||
expect(mockApi.worktrees.updateMeta).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('does not link an arbitrary same-repo terminal PR URL for a known push target when lookup misses', async () => {
|
||||
const store = createTestStore()
|
||||
installReviewRead().mockResolvedValue(null)
|
||||
const wt = makeWorktree({
|
||||
id: 'repo1::/path/wt1',
|
||||
repoId: 'repo1',
|
||||
path: '/worktrees/orca',
|
||||
branch: 'refs/heads/feature/pr-link',
|
||||
pushTarget: {
|
||||
remoteName: 'origin',
|
||||
branchName: 'feature/pr-link',
|
||||
remoteUrl: 'https://github.com/acme/orca.git'
|
||||
}
|
||||
})
|
||||
store.setState({
|
||||
repos: [
|
||||
{ id: 'repo1', path: '/repos/orca', displayName: 'orca', badgeColor: '#000', addedAt: 0 }
|
||||
],
|
||||
worktreesByRepo: { repo1: [wt] }
|
||||
})
|
||||
|
||||
store.getState().observeTerminalGitHubPullRequestLink(wt.id, {
|
||||
url: 'https://github.com/acme/orca/pull/1',
|
||||
slug: { owner: 'acme', repo: 'orca' },
|
||||
number: 1
|
||||
})
|
||||
|
||||
for (let i = 0; i < 20; i++) {
|
||||
await Promise.resolve()
|
||||
}
|
||||
|
||||
expect(store.getState().worktreesByRepo.repo1[0]?.linkedPR).toBeNull()
|
||||
expect(mockApi.worktrees.updateMeta).not.toHaveBeenCalledWith({
|
||||
worktreeId: wt.id,
|
||||
updates: { linkedPR: 1 }
|
||||
})
|
||||
})
|
||||
|
||||
it('rejects a same-number branch result for a different repository URL', async () => {
|
||||
const store = createTestStore()
|
||||
const readHostedReview = installReviewRead().mockResolvedValue(confirmedReview(42))
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { createTestStore, makeWorktree, seedStore } from '../slices/store-test-helpers'
|
||||
import { createStoreCascadesMockApi } from '../slices/store-cascades-test-harness'
|
||||
import { toWebTerminalSurfaceTabId } from '../../../../shared/terminal-surface-id'
|
||||
createStoreCascadesMockApi()
|
||||
const WT = 'repo1::/path/wt1'
|
||||
const MIRRORED = toWebTerminalSurfaceTabId('host-tab-1')
|
||||
function seeded() {
|
||||
const store = createTestStore()
|
||||
seedStore(store, {
|
||||
worktreesByRepo: { repo1: [makeWorktree({ id: WT, repoId: 'repo1', path: '/path/wt1' })] },
|
||||
activeWorktreeId: WT
|
||||
})
|
||||
return store
|
||||
}
|
||||
describe('createTab with a mirrored host tab id', () => {
|
||||
it('keeps the id so the host snapshot finds the tab', () => {
|
||||
const store = seeded()
|
||||
const tab = store.getState().createTab(WT, undefined, undefined, {
|
||||
id: MIRRORED,
|
||||
mirroredHostTab: true
|
||||
})
|
||||
expect(tab.id).toBe(MIRRORED)
|
||||
expect(store.getState().tabsByWorktree[WT]?.map((entry) => entry.id)).toContain(MIRRORED)
|
||||
expect(() =>
|
||||
store.getState().createTab(WT, undefined, undefined, { id: MIRRORED, mirroredHostTab: true })
|
||||
).toThrow(/already exists/)
|
||||
})
|
||||
})
|
||||
@@ -1,36 +0,0 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { searchResults } from '../../../../shared/ai-vault-search-test-fixture'
|
||||
import { unavailableSessionSearchStatus } from '../../../../shared/ai-vault-search-client'
|
||||
import { AI_VAULT_AGENTS } from '../../../../shared/ai-vault-types'
|
||||
|
||||
const callRuntimeResult = vi.hoisted(() => vi.fn())
|
||||
vi.mock('./web-runtime-calls', () => ({ callRuntimeResult }))
|
||||
vi.mock('./web-runtime-session', () => ({
|
||||
requireActiveEnvironment: () => ({ id: 'owning-host' })
|
||||
}))
|
||||
import { createWebAiVaultApi } from './web-ai-vault-api'
|
||||
|
||||
beforeEach(() => {
|
||||
callRuntimeResult.mockReset()
|
||||
})
|
||||
|
||||
describe('web session search preload compatibility', () => {
|
||||
it('calls the selected host, parses its response and applies remote exposure', async () => {
|
||||
callRuntimeResult.mockResolvedValue(searchResults())
|
||||
const api = createWebAiVaultApi()
|
||||
const result = await api.searchSessions({ query: 'needle' })
|
||||
expect(callRuntimeResult).toHaveBeenCalledExactlyOnceWith('aiVault.searchSessions', {
|
||||
query: 'needle',
|
||||
limit: 20,
|
||||
supportedAgents: [...AI_VAULT_AGENTS],
|
||||
supportsQoderHistory: true,
|
||||
supportsJcodeHistory: true
|
||||
})
|
||||
expect(result).toMatchObject({ kind: 'results', hits: [{ source: { presence: 'present' } }] })
|
||||
expect(JSON.stringify(result)).not.toContain('resumeCommand')
|
||||
expect(result).not.toHaveProperty('debug')
|
||||
callRuntimeResult.mockResolvedValue(unavailableSessionSearchStatus())
|
||||
expect(await api.searchStatus()).toEqual(unavailableSessionSearchStatus())
|
||||
expect(callRuntimeResult).toHaveBeenLastCalledWith('aiVault.searchStatus', {})
|
||||
})
|
||||
})
|
||||
@@ -1,35 +0,0 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { takeBrowserAttachmentFile } from '@/lib/browser-attachment-files'
|
||||
import { createShellApi } from './web-shell-api'
|
||||
|
||||
vi.mock('./web-runtime-worktree-catalog', () => ({ resolveRuntimeFilePath: vi.fn() }))
|
||||
|
||||
function chooseOnClick(files: File[] | null): void {
|
||||
vi.spyOn(HTMLInputElement.prototype, 'click').mockImplementation(function (
|
||||
this: HTMLInputElement
|
||||
) {
|
||||
if (files === null) {
|
||||
this.dispatchEvent(new Event('cancel'))
|
||||
return
|
||||
}
|
||||
Object.defineProperty(this, 'files', { value: files })
|
||||
this.dispatchEvent(new Event('change'))
|
||||
})
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
})
|
||||
|
||||
describe('web chat attachment picker', () => {
|
||||
it('opens the browser file picker and returns tokens the chat upload can read', async () => {
|
||||
const files = [new File(['a'], 'a.txt'), new File(['b'], 'b.png')]
|
||||
chooseOnClick(files)
|
||||
|
||||
const tokens = await createShellApi().pickAttachments!()
|
||||
|
||||
expect(tokens).toHaveLength(2)
|
||||
expect(tokens.map((token) => takeBrowserAttachmentFile(token))).toEqual(files)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user