mirror of
https://github.com/stablyai/orca.git
synced 2026-10-13 00:02:54 +00:00
test: load renderer fixture builders without the full Store (#26217)
This commit is contained in:
@@ -22,7 +22,7 @@ import type { DirectSshAuthority, SshProviderEpoch } from '../../../shared/ssh-t
|
||||
import type { DirectSshPreparationInput } from '../hooks/direct-ssh-reconnect-coordinator'
|
||||
import { createRemoteWorkspaceTargetSync } from '../hooks/remote-workspace-target-sync'
|
||||
import { isDirectSshRemoteWorkspaceApplyInProgress } from '../hooks/remote-workspace-snapshot-apply'
|
||||
import { makeWorktree } from '../store/slices/store-test-helpers'
|
||||
import { makeWorktree } from '../store/slices/worktrees-slice-test-fixtures'
|
||||
|
||||
vi.mock('sonner', () => ({ toast: { info: vi.fn(), success: vi.fn(), error: vi.fn() } }))
|
||||
vi.mock('@/lib/agent-status', async (importOriginal) => {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { useAppStore } from '@/store'
|
||||
import { makeOpenFile } from '@/store/slices/store-test-helpers'
|
||||
import { makeOpenFile } from '../../store/slices/store-session-test-harness'
|
||||
import { makeRetainedDoneEntry, makeTab, makeWorktree } from './ActivityPrototypePage-test-fixtures'
|
||||
import type { AgentPaneThread } from './activity-thread-types'
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { createRoot, type Root } from 'react-dom/client'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type * as RuntimeFileClient from '@/runtime/runtime-file-client'
|
||||
import { useAppStore } from '@/store'
|
||||
import { makeWorktree } from '@/store/slices/store-test-helpers'
|
||||
import { makeWorktree } from '../../store/slices/worktrees-slice-test-fixtures'
|
||||
import type { FileContent } from './editor-panel-content-types'
|
||||
import {
|
||||
useEditorPanelFileContentLoader,
|
||||
|
||||
+5
-1
@@ -3,7 +3,11 @@ import { renderHook } from '@testing-library/react'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { FLOATING_TERMINAL_WORKTREE_ID, getDefaultSettings } from '../../../../shared/constants'
|
||||
import { useAppStore } from '@/store'
|
||||
import { makeOpenFile, makeTabGroup, makeUnifiedTab } from '@/store/slices/store-test-helpers'
|
||||
import {
|
||||
makeOpenFile,
|
||||
makeTabGroup,
|
||||
makeUnifiedTab
|
||||
} from '../../store/slices/store-session-test-harness'
|
||||
import { useFloatingTerminalCloseActions } from './use-floating-terminal-close-actions'
|
||||
|
||||
const requestEditorFileClose = vi.hoisted(() => vi.fn())
|
||||
|
||||
+2
-6
@@ -73,12 +73,8 @@ import {
|
||||
getStructuredAgentSessionStatusFeed,
|
||||
resetStructuredAgentSessionStatusFeedsForTests
|
||||
} from '@/runtime/structured-agent-session-status-feed'
|
||||
import {
|
||||
makeTabGroup,
|
||||
makeUnifiedTab,
|
||||
makeWorktree,
|
||||
TEST_REPO
|
||||
} from '@/store/slices/store-test-helpers'
|
||||
import { makeTabGroup, makeUnifiedTab } from '../../store/slices/store-session-test-harness'
|
||||
import { makeWorktree, TEST_REPO } from '../../store/slices/worktrees-slice-test-fixtures'
|
||||
|
||||
// Worktree ids encode their repo (`repoId::path`); the unread reducer buckets by that prefix.
|
||||
const WORKSPACE = 'repo1::/tmp/wt'
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ import type { Repo } from '../../../../shared/repo-types'
|
||||
import type { Worktree } from '../../../../shared/worktree/types'
|
||||
import { useAppStore } from '@/store'
|
||||
import type { AppState } from '@/store/types'
|
||||
import { makeWorktree, TEST_REPO } from '@/store/slices/store-test-helpers'
|
||||
import { makeWorktree, TEST_REPO } from '../../store/slices/worktrees-slice-test-fixtures'
|
||||
import { useChecksPanelTerminalWorktree } from './use-checks-panel-terminal-worktree'
|
||||
|
||||
const initialAppState = useAppStore.getInitialState()
|
||||
|
||||
@@ -7,7 +7,8 @@ import type { Repo } from '../../../../shared/repo-types'
|
||||
import type { Worktree } from '../../../../shared/worktree/types'
|
||||
import { useAppStore } from '@/store'
|
||||
import type { AppState } from '@/store/types'
|
||||
import { makeOpenFile, makeWorktree, TEST_REPO } from '@/store/slices/store-test-helpers'
|
||||
import { makeOpenFile } from '../../store/slices/store-session-test-harness'
|
||||
import { makeWorktree, TEST_REPO } from '../../store/slices/worktrees-slice-test-fixtures'
|
||||
import { ORCA_WORKTREE_FILE_CHANGE_EVENT } from '@/hooks/worktree-file-change-event'
|
||||
import { useGitStatusPolling } from './useGitStatusPolling'
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { cleanup, fireEvent, render } from '@testing-library/react'
|
||||
import React from 'react'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { makeWorktree } from '../../store/slices/store-test-helpers'
|
||||
import { makeWorktree } from '../../store/slices/worktrees-slice-test-fixtures'
|
||||
import WorkspaceKanbanCard from './WorkspaceKanbanCard'
|
||||
|
||||
vi.mock('@/components/ui/badge', () => ({
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
AGENT_STATUS_STALE_AFTER_MS,
|
||||
type AgentStatusEntry
|
||||
} from '../../../../shared/agent-status-types'
|
||||
import { makeTab } from '../../store/slices/store-test-helpers'
|
||||
import { makeTab } from '../../store/slices/store-session-test-harness'
|
||||
import { buildWorktreeAgentRows } from './worktree-agent-rows'
|
||||
import { getAgentDotState } from './worktree-card-agent-summary'
|
||||
import { getCompactAgentSecondary } from './worktree-card-compact-agent-row'
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { AgentStatusEntry } from '../../../../shared/agent-status-types'
|
||||
import { makeTab } from '../../store/slices/store-test-helpers'
|
||||
import { makeTab } from '../../store/slices/store-session-test-harness'
|
||||
import { buildWorktreeAgentRows } from './worktree-agent-rows'
|
||||
import { getAgentDotState } from './worktree-card-agent-summary'
|
||||
import { getCompactAgentLineOrder } from './worktree-card-compact-agent-line-order'
|
||||
|
||||
@@ -23,7 +23,7 @@ import type { AppState } from '@/store/types'
|
||||
import type { Worktree } from '../../../../shared/worktree/types'
|
||||
import type { ExecutionHostId } from '../../../../shared/execution-host'
|
||||
import { makeWorktree } from '@/store/slices/worktrees-slice-test-fixtures'
|
||||
import { makeTab } from '@/store/slices/store-test-helpers'
|
||||
import { makeTab } from '../../store/slices/store-session-test-harness'
|
||||
import {
|
||||
createTestStore,
|
||||
mockApi,
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ vi.mock('@/store/pinned-tab-close-guard', () => ({
|
||||
|
||||
import { dispatchWorkspaceTabCommand } from '@/lib/workspace-tab-commands'
|
||||
import { useAppStore } from '../../store'
|
||||
import { makeOpenFile } from '../../store/slices/store-test-helpers'
|
||||
import { makeOpenFile } from '../../store/slices/store-session-test-harness'
|
||||
|
||||
const terminalTab: Tab = {
|
||||
id: 'unified-terminal',
|
||||
|
||||
@@ -2,7 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { dispatchTerminalNotification } from './use-notification-dispatch'
|
||||
import { AGENT_STATUS_STALE_AFTER_MS } from '../../../../shared/agent-status-types'
|
||||
import { buildAgentNotificationId } from '../../../../shared/agent-notification-id'
|
||||
import { makeTabGroup, makeUnifiedTab } from '@/store/slices/store-test-helpers'
|
||||
import { makeTabGroup, makeUnifiedTab } from '../../store/slices/store-session-test-harness'
|
||||
import {
|
||||
LIVE_LEAF_ID,
|
||||
PANE_KEY,
|
||||
|
||||
+2
-1
@@ -2,7 +2,8 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type * as SnapshotCapabilityModule from './terminal-provider-snapshot-capability'
|
||||
import type { TerminalLayoutSnapshot } from '../../../../shared/terminal-tab-types'
|
||||
import { makeTab, makeWorktree } from '@/store/slices/store-test-helpers'
|
||||
import { makeTab } from '../../store/slices/store-session-test-harness'
|
||||
import { makeWorktree } from '../../store/slices/worktrees-slice-test-fixtures'
|
||||
|
||||
const { collectPtyIds } = vi.hoisted(() => ({ collectPtyIds: vi.fn() }))
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ vi.mock('../../../../main/providers/ssh-git-dispatch', () => ({
|
||||
vi.mock('sonner', () => ({ toast: { error: vi.fn(), success: vi.fn(), warning: vi.fn() } }))
|
||||
|
||||
import { useAppStore } from '@/store'
|
||||
import { makeWorktree } from '@/store/slices/store-test-helpers'
|
||||
import { makeWorktree } from '../../store/slices/worktrees-slice-test-fixtures'
|
||||
import { resetAuthoritativelyRemovedWorktreeMemoryForTests } from '@/store/slices/worktrees'
|
||||
import { useWorkspaceCleanupRemoval } from './use-workspace-cleanup-removal'
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { act, cleanup, renderHook, waitFor } from '@testing-library/react'
|
||||
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
|
||||
import { useAutoAckViewedAgent } from './useAutoAckViewedAgent'
|
||||
import { useAppStore } from '../store'
|
||||
import { makeTab, makeTabGroup, makeUnifiedTab } from '../store/slices/store-test-helpers'
|
||||
import { makeTab, makeTabGroup, makeUnifiedTab } from '../store/slices/store-session-test-harness'
|
||||
import { makePaneKey } from '../../../shared/stable-pane-id'
|
||||
import { createNotificationsApi } from '../web/preload-api/web-notifications-api'
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type * as AgentAutoAckPresence from './agent-auto-ack-presence'
|
||||
import { useAutoAckViewedAgent } from './useAutoAckViewedAgent'
|
||||
import { useAppStore } from '../store'
|
||||
import { makeTab, makeTabGroup, makeUnifiedTab } from '../store/slices/store-test-helpers'
|
||||
import { makeTab, makeTabGroup, makeUnifiedTab } from '../store/slices/store-session-test-harness'
|
||||
import { makePaneKey } from '../../../shared/stable-pane-id'
|
||||
import type { AgentStatusEntry } from '../../../shared/agent-status-types'
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import type * as AgentAutoAckPresence from './agent-auto-ack-presence'
|
||||
import { useAutoAckViewedAgent } from './useAutoAckViewedAgent'
|
||||
import { useAppStore } from '../store'
|
||||
import { selectFloatingWorkspaceHasUnread } from '../store/selectors'
|
||||
import { makeTab, makeTabGroup, makeUnifiedTab } from '../store/slices/store-test-helpers'
|
||||
import { makeTab, makeTabGroup, makeUnifiedTab } from '../store/slices/store-session-test-harness'
|
||||
import { FLOATING_TERMINAL_WORKTREE_ID, getDefaultSettings } from '../../../shared/constants'
|
||||
import { makePaneKey } from '../../../shared/stable-pane-id'
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type * as AgentAutoAckPresence from './agent-auto-ack-presence'
|
||||
import { useAutoAckViewedAgent } from './useAutoAckViewedAgent'
|
||||
import { useAppStore } from '../store'
|
||||
import { makeTab, makeTabGroup, makeUnifiedTab } from '../store/slices/store-test-helpers'
|
||||
import { makeTab, makeTabGroup, makeUnifiedTab } from '../store/slices/store-session-test-harness'
|
||||
import { structuredAgentSessionPaneKey } from '../../../shared/structured-agent-session-projection'
|
||||
|
||||
vi.mock('./agent-auto-ack-presence', async (importOriginal) => ({
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
import { act, cleanup, renderHook } from '@testing-library/react'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type * as UnreadBadgeCountModule from '@/lib/unread-badge-count'
|
||||
import { makeFolderWorkspace } from '@/store/slices/worktrees-slice-test-fixtures'
|
||||
import { makeTab, makeWorktree } from '@/store/slices/store-test-helpers'
|
||||
import { makeFolderWorkspace, makeWorktree } from '@/store/slices/worktrees-slice-test-fixtures'
|
||||
import { makeTab } from '../store/slices/store-session-test-harness'
|
||||
import { FLOATING_TERMINAL_WORKTREE_ID, getDefaultSettings } from '../../../shared/constants'
|
||||
|
||||
const { getUnreadBadgeCount } = vi.hoisted(() => ({ getUnreadBadgeCount: vi.fn() }))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { useAppStore, type AppState } from '@/store'
|
||||
import { makeTab } from '@/store/slices/store-test-helpers'
|
||||
import { makeTab } from '../store/slices/store-session-test-harness'
|
||||
import {
|
||||
clearRuntimeEnvironmentConnectionGenerationsForTests,
|
||||
setRuntimeEnvironmentConnectionGenerationForTests
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { SleepingAgentSessionRecord } from '../../../shared/agent-session-resume'
|
||||
import { useAppStore } from '@/store'
|
||||
import { makeWorktree } from '@/store/slices/store-test-helpers'
|
||||
import { makeWorktree } from '../store/slices/worktrees-slice-test-fixtures'
|
||||
import { resumeSleepingAgentSessionsForWorktree } from './resume-sleeping-agent-session'
|
||||
|
||||
const initialAppStoreState = useAppStore.getState()
|
||||
|
||||
@@ -17,7 +17,7 @@ import { afterEach, describe, expect, it } from 'vitest'
|
||||
import type { SleepingAgentSessionRecord } from '../../../shared/agent-session-resume'
|
||||
import type { ExecutionHostId } from '../../../shared/execution-host'
|
||||
import { useAppStore } from '@/store'
|
||||
import { makeWorktree, TEST_REPO } from '@/store/slices/store-test-helpers'
|
||||
import { makeWorktree, TEST_REPO } from '../store/slices/worktrees-slice-test-fixtures'
|
||||
import { resumeSleepingAgentSessionsForWorktree } from './resume-sleeping-agent-session'
|
||||
import {
|
||||
agentResumeOriginNamesAnotherExecutionHost,
|
||||
|
||||
@@ -11,7 +11,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import type { SleepingAgentSessionRecord } from '../../../shared/agent-session-resume'
|
||||
import type { TerminalTab } from '../../../shared/terminal-tab-types'
|
||||
import { useAppStore } from '@/store'
|
||||
import { makeWorktree } from '@/store/slices/store-test-helpers'
|
||||
import { makeWorktree } from '../store/slices/worktrees-slice-test-fixtures'
|
||||
import { resolveWorkspaceTerminalHostAuthority } from './workspace-terminal-host-authority'
|
||||
import { resumeSleepingAgentSessionsForWorktree } from './resume-sleeping-agent-session'
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { makeTab, makeWorktree, TEST_REPO } from '@/store/slices/store-test-helpers'
|
||||
import { makeTab } from '../store/slices/store-session-test-harness'
|
||||
import { makeWorktree, TEST_REPO } from '../store/slices/worktrees-slice-test-fixtures'
|
||||
import { makeFolderWorkspace } from '@/store/slices/worktrees-slice-test-fixtures'
|
||||
import type { ProjectGroup } from '../../../shared/project-group-types'
|
||||
import { getUnreadBadgeCount, type UnreadBadgeCountSources } from './unread-badge-count'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { makeTab, makeWorktree, TEST_REPO } from '@/store/slices/store-test-helpers'
|
||||
import { makeTab } from '../store/slices/store-session-test-harness'
|
||||
import { makeWorktree, TEST_REPO } from '../store/slices/worktrees-slice-test-fixtures'
|
||||
import { makeFolderWorkspace } from '@/store/slices/worktrees-slice-test-fixtures'
|
||||
import type { ProjectGroup } from '../../../shared/project-group-types'
|
||||
import type { Worktree } from '../../../shared/worktree/types'
|
||||
|
||||
@@ -7,7 +7,7 @@ import { getDefaultSettings } from '../../../shared/constants'
|
||||
import type { ProjectGroup } from '../../../shared/project-group-types'
|
||||
import type { Repo } from '../../../shared/repo-types'
|
||||
import type * as RuntimeSessionMirrorTargetsModule from '@/lib/runtime-session-mirror-targets'
|
||||
import { makeWorktree } from '@/store/slices/store-test-helpers'
|
||||
import { makeWorktree } from '../store/slices/worktrees-slice-test-fixtures'
|
||||
|
||||
const { getMirrorTargets } = vi.hoisted(() => ({ getMirrorTargets: vi.fn() }))
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { createEditorTabsStore } from './editor-slice-test-harness'
|
||||
import { makeWorktree, TEST_REPO } from './store-test-helpers'
|
||||
import { makeWorktree, TEST_REPO } from './worktrees-slice-test-fixtures'
|
||||
import { getDefaultSettings } from '../../../../shared/constants'
|
||||
import {
|
||||
assertEditorFileOperationCurrent,
|
||||
|
||||
@@ -4,7 +4,7 @@ import { createEditorSlice } from './editor'
|
||||
import type { AppState } from '../types'
|
||||
import type { BrowserTab } from '../../../../shared/browser-workspace-types'
|
||||
import type { Tab, TabContentType, TabGroup } from '../../../../shared/tab-types'
|
||||
import { makeTab } from './store-test-helpers'
|
||||
import { makeTab } from './store-session-test-harness'
|
||||
|
||||
function createEditorStore(overrides?: Partial<AppState>): StoreApi<AppState> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { vi, type Mock } from 'vitest'
|
||||
import type { BrowserTab } from '../../../../shared/browser-workspace-types'
|
||||
import type { Tab, TabGroup } from '../../../../shared/tab-types'
|
||||
import type { TerminalLayoutSnapshot, TerminalTab } from '../../../../shared/terminal-tab-types'
|
||||
import type { OpenFile } from './editor'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
|
||||
/** Shape shared by the Claude/Codex/OpenCode usage-scanner namespaces. */
|
||||
type UsageScannerMocks = {
|
||||
@@ -128,3 +132,59 @@ export function makeBrowserTab(
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
export function makeTab(
|
||||
overrides: Partial<TerminalTab> & { id: string; worktreeId: string }
|
||||
): TerminalTab {
|
||||
return {
|
||||
ptyId: null,
|
||||
title: translate('auto.store.slices.store.test.helpers.b9a8117c33', 'Terminal 1'),
|
||||
customTitle: null,
|
||||
color: null,
|
||||
sortOrder: 0,
|
||||
createdAt: Date.now(),
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
export function makeLayout(): TerminalLayoutSnapshot {
|
||||
return { root: null, activeLeafId: null, expandedLeafId: null }
|
||||
}
|
||||
|
||||
export function makeOpenFile(
|
||||
overrides: Partial<OpenFile> & { id: string; worktreeId: string }
|
||||
): OpenFile {
|
||||
return {
|
||||
filePath: overrides.id,
|
||||
relativePath: 'file.ts',
|
||||
language: 'typescript',
|
||||
isDirty: false,
|
||||
mode: 'edit',
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
export function makeUnifiedTab(
|
||||
overrides: Partial<Tab> & { id: string; worktreeId: string; groupId: string }
|
||||
): Tab {
|
||||
return {
|
||||
entityId: overrides.id,
|
||||
contentType: 'terminal',
|
||||
label: translate('auto.store.slices.store.test.helpers.b9a8117c33', 'Terminal 1'),
|
||||
customLabel: null,
|
||||
color: null,
|
||||
sortOrder: 0,
|
||||
createdAt: Date.now(),
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
export function makeTabGroup(
|
||||
overrides: Partial<TabGroup> & { id: string; worktreeId: string }
|
||||
): TabGroup {
|
||||
return {
|
||||
activeTabId: null,
|
||||
tabOrder: [],
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import { create } from 'zustand'
|
||||
import type { AppState } from '../types'
|
||||
import type { Tab, TabGroup } from '../../../../shared/tab-types'
|
||||
import type { TerminalLayoutSnapshot, TerminalTab } from '../../../../shared/terminal-tab-types'
|
||||
import type { Worktree } from '../../../../shared/worktree/types'
|
||||
import type { OpenFile } from './editor'
|
||||
import { createRepoSlice } from './repos'
|
||||
import { createSparsePresetsSlice } from './sparse-presets'
|
||||
import { createWorktreeSlice } from './worktrees'
|
||||
@@ -52,15 +49,16 @@ import { createTaskCreationDraftsSlice } from './task-creation-drafts'
|
||||
import { createRemoteServerUpdatesSlice } from './remote-server-updates'
|
||||
import { createTerminalQuickCommandHostsSlice } from './terminal-quick-command-hosts'
|
||||
import { createStructuredSessionLaunchDirectorySlice } from './structured-session-launch-directories'
|
||||
import { translate } from '@/i18n/i18n'
|
||||
|
||||
export const TEST_REPO = {
|
||||
id: 'repo1',
|
||||
path: '/repo1',
|
||||
displayName: 'Repo 1',
|
||||
badgeColor: '#000',
|
||||
addedAt: 0
|
||||
}
|
||||
import '@/i18n/i18n'
|
||||
import { makeWorktree, TEST_REPO } from './worktrees-slice-test-fixtures'
|
||||
export { makeWorktree, TEST_REPO } from './worktrees-slice-test-fixtures'
|
||||
export {
|
||||
makeTab,
|
||||
makeLayout,
|
||||
makeOpenFile,
|
||||
makeUnifiedTab,
|
||||
makeTabGroup
|
||||
} from './store-session-test-harness'
|
||||
|
||||
export function createTestStore() {
|
||||
return create<AppState>()((...a) => ({
|
||||
@@ -126,31 +124,6 @@ export function seedStore(
|
||||
})
|
||||
}
|
||||
|
||||
export function makeWorktree(
|
||||
overrides: Partial<Worktree> & { id: string; repoId: string }
|
||||
): Worktree {
|
||||
return {
|
||||
path: '/tmp/wt',
|
||||
head: 'abc123',
|
||||
branch: 'refs/heads/feature',
|
||||
isBare: false,
|
||||
isMainWorktree: false,
|
||||
displayName: 'feature',
|
||||
comment: '',
|
||||
linkedIssue: null,
|
||||
linkedPR: null,
|
||||
linkedLinearIssue: null,
|
||||
linkedGitLabMR: null,
|
||||
linkedGitLabIssue: null,
|
||||
isArchived: false,
|
||||
isUnread: false,
|
||||
isPinned: false,
|
||||
sortOrder: 0,
|
||||
lastActivityAt: 0,
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
export function makeRuntimeOwnedWorktree(
|
||||
overrides: Partial<Worktree> & { id: string; repoId: string },
|
||||
runtimeEnvironmentId = 'runtime-1'
|
||||
@@ -161,59 +134,3 @@ export function makeRuntimeOwnedWorktree(
|
||||
runtimeOwnerEnvironmentId: runtimeEnvironmentId
|
||||
})
|
||||
}
|
||||
|
||||
export function makeTab(
|
||||
overrides: Partial<TerminalTab> & { id: string; worktreeId: string }
|
||||
): TerminalTab {
|
||||
return {
|
||||
ptyId: null,
|
||||
title: translate('auto.store.slices.store.test.helpers.b9a8117c33', 'Terminal 1'),
|
||||
customTitle: null,
|
||||
color: null,
|
||||
sortOrder: 0,
|
||||
createdAt: Date.now(),
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
export function makeLayout(): TerminalLayoutSnapshot {
|
||||
return { root: null, activeLeafId: null, expandedLeafId: null }
|
||||
}
|
||||
|
||||
export function makeOpenFile(
|
||||
overrides: Partial<OpenFile> & { id: string; worktreeId: string }
|
||||
): OpenFile {
|
||||
return {
|
||||
filePath: overrides.id,
|
||||
relativePath: 'file.ts',
|
||||
language: 'typescript',
|
||||
isDirty: false,
|
||||
mode: 'edit',
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
export function makeUnifiedTab(
|
||||
overrides: Partial<Tab> & { id: string; worktreeId: string; groupId: string }
|
||||
): Tab {
|
||||
return {
|
||||
entityId: overrides.id,
|
||||
contentType: 'terminal',
|
||||
label: translate('auto.store.slices.store.test.helpers.b9a8117c33', 'Terminal 1'),
|
||||
customLabel: null,
|
||||
color: null,
|
||||
sortOrder: 0,
|
||||
createdAt: Date.now(),
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
export function makeTabGroup(
|
||||
overrides: Partial<TabGroup> & { id: string; worktreeId: string }
|
||||
): TabGroup {
|
||||
return {
|
||||
activeTabId: null,
|
||||
tabOrder: [],
|
||||
...overrides
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,14 @@ import type { TerminalTab } from '../../../../shared/terminal-tab-types'
|
||||
import type { WorkspaceLineage, WorktreeLineage } from '../../../../shared/worktree/lineage-types'
|
||||
import type { Worktree } from '../../../../shared/worktree/types'
|
||||
|
||||
export const TEST_REPO = {
|
||||
id: 'repo1',
|
||||
path: '/repo1',
|
||||
displayName: 'Repo 1',
|
||||
badgeColor: '#000',
|
||||
addedAt: 0
|
||||
}
|
||||
|
||||
export function makeWorktree(
|
||||
overrides: Partial<Worktree> & { id: string; repoId: string }
|
||||
): Worktree {
|
||||
|
||||
Reference in New Issue
Block a user