mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
refactor: colocate persistence settings and automation tests (#33058)
This commit is contained in:
@@ -3711,8 +3711,8 @@
|
||||
"src/main/orcad/serve-profile-ssh-targets.test.ts": 429,
|
||||
"src/main/own-chromium-tree-kill-guard.test.ts": 113,
|
||||
"src/main/persistence-async-write-syscalls.test.ts": 2801,
|
||||
"src/main/persistence-automation-extra-agent-args.test.ts": 1694,
|
||||
"src/main/persistence-automations.test.ts": 2080,
|
||||
"src/main/persistence/applying-settings/persistence-automation-extra-agent-args.test.ts": 1694,
|
||||
"src/main/persistence/applying-settings/persistence-automations.test.ts": 2080,
|
||||
"src/main/persistence-clipboard-selection-migration.test.ts": 1954,
|
||||
"src/main/persistence-cohort-and-identity-migration.test.ts": 1714,
|
||||
"src/main/persistence-cross-host-pane-identity.test.ts": 1627,
|
||||
@@ -3727,15 +3727,15 @@
|
||||
"src/main/persistence-host-partitioned-sessions.test.ts": 1852,
|
||||
"src/main/persistence-host-partitioned-ssh-pty-bindings.test.ts": 1580,
|
||||
"src/main/persistence-initial-load.test.ts": 1852,
|
||||
"src/main/persistence-jira-project.test.ts": 1400,
|
||||
"src/main/persistence-jira-saved-filters.test.ts": 1531,
|
||||
"src/main/persistence/applying-settings/persistence-jira-project.test.ts": 1400,
|
||||
"src/main/persistence/applying-settings/persistence-jira-saved-filters.test.ts": 1531,
|
||||
"src/main/persistence-layout-binding-recovery.test.ts": 1550,
|
||||
"src/main/persistence-load-repair-durability.test.ts": 1535,
|
||||
"src/main/persistence-loading-store-extraction.test.ts": 1773,
|
||||
"src/main/persistence-loading-store-write-risks.test.ts": 1640,
|
||||
"src/main/persistence-native-chat-appearance.test.ts": 1369,
|
||||
"src/main/persistence-native-chat-tab-view-mode.test.ts": 1365,
|
||||
"src/main/persistence-native-chat-upgrade-tip-audience.test.ts": 1983,
|
||||
"src/main/persistence/applying-settings/persistence-native-chat-appearance.test.ts": 1369,
|
||||
"src/main/persistence/applying-settings/persistence-native-chat-tab-view-mode.test.ts": 1365,
|
||||
"src/main/persistence/applying-settings/persistence-native-chat-upgrade-tip-audience.test.ts": 1983,
|
||||
"src/main/persistence/migrating-orcad-catalog/persistence-orcad-migration-catalog.test.ts": 2096,
|
||||
"src/main/persistence/migrating-orcad-catalog/persistence-orcad-repository-cache-reimport.test.ts": 1587,
|
||||
"src/main/persistence-pane-alias-selective-saves.test.ts": 1608,
|
||||
@@ -3747,12 +3747,12 @@
|
||||
"src/main/persistence-pty-binding-reconciliation.test.ts": 1631,
|
||||
"src/main/persistence-remote-session-startup.test.ts": 1481,
|
||||
"src/main/persistence-repo-lifecycle.test.ts": 3167,
|
||||
"src/main/persistence-right-sidebar-tab.test.ts": 1444,
|
||||
"src/main/persistence/applying-settings/persistence-right-sidebar-tab.test.ts": 1444,
|
||||
"src/main/persistence-runtime-admitted-terminal-membership.test.ts": 1419,
|
||||
"src/main/persistence-settings-ui-defaults.test.ts": 2214,
|
||||
"src/main/persistence-settings-update.test.ts": 2072,
|
||||
"src/main/persistence/applying-settings/persistence-settings-ui-defaults.test.ts": 2214,
|
||||
"src/main/persistence/applying-settings/persistence-settings-update.test.ts": 2072,
|
||||
"src/main/persistence-single-serialize.test.ts": 1630,
|
||||
"src/main/persistence-source-control-ai-migration.test.ts": 1770,
|
||||
"src/main/persistence/applying-settings/persistence-source-control-ai-migration.test.ts": 1770,
|
||||
"src/main/persistence-split-pane-incarnation.test.ts": 1586,
|
||||
"src/main/persistence-ssh-lease-tombstone-retention.test.ts": 1552,
|
||||
"src/main/persistence-ssh-pending-pty-kill.test.ts": 1505,
|
||||
@@ -3760,9 +3760,9 @@
|
||||
"src/main/persistence-ssh-remote-pty-binding-replay.test.ts": 1537,
|
||||
"src/main/persistence-ssh-remote-pty-leases.test.ts": 1759,
|
||||
"src/main/persistence-ssh-targets-and-pane-keys.test.ts": 1788,
|
||||
"src/main/persistence-status-bar-compact-change-notice.test.ts": 1688,
|
||||
"src/main/persistence/applying-settings/persistence-status-bar-compact-change-notice.test.ts": 1688,
|
||||
"src/main/persistence-terminal-option-key-migration.test.ts": 1645,
|
||||
"src/main/persistence-ui-state.test.ts": 3132,
|
||||
"src/main/persistence/applying-settings/persistence-ui-state.test.ts": 3132,
|
||||
"src/main/persistence-update-repo.test.ts": 1760,
|
||||
"src/main/persistence-workspace-attachments.test.ts": 1584,
|
||||
"src/main/persistence-workspace-pinned-automation-fence.test.ts": 2063,
|
||||
|
||||
+4
-4
@@ -4,13 +4,13 @@ import {
|
||||
createStore,
|
||||
readDataFile,
|
||||
makeRepo
|
||||
} from './persistence-test-harness'
|
||||
} from '../../persistence-test-harness'
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { rmSync, mkdtempSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { tmpdir } from 'node:os'
|
||||
|
||||
vi.mock('./ssh/config/ssh-config-parser', () => ({
|
||||
vi.mock('../../ssh/config/ssh-config-parser', () => ({
|
||||
loadUserSshConfig: vi.fn(),
|
||||
sshConfigHostsToTargets: vi.fn()
|
||||
}))
|
||||
@@ -24,8 +24,8 @@ vi.mock('electron', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('./telemetry/client', () => ({ track: vi.fn() }))
|
||||
vi.mock('./telemetry/cohort-classifier', () => ({
|
||||
vi.mock('../../telemetry/client', () => ({ track: vi.fn() }))
|
||||
vi.mock('../../telemetry/cohort-classifier', () => ({
|
||||
getCohortAtEmit: vi.fn(() => ({ nth_repo_added: 2 }))
|
||||
}))
|
||||
|
||||
+8
-8
@@ -5,22 +5,22 @@ import {
|
||||
writeDataFile,
|
||||
readDataFile,
|
||||
makeRepo
|
||||
} from './persistence-test-harness'
|
||||
} from '../../persistence-test-harness'
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { rmSync, mkdtempSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { tmpdir } from 'node:os'
|
||||
import type { PersistedState } from '../shared/persisted-state-types'
|
||||
import { toRuntimeExecutionHostId, toSshExecutionHostId } from '../shared/execution-host'
|
||||
import { hostWorktreeTarget } from '../shared/worktree/host-qualified-identity'
|
||||
import { removeWorktreeMetaRow } from './persistence/host-qualified-worktree-meta'
|
||||
import type { PersistedState } from '../../../shared/persisted-state-types'
|
||||
import { toRuntimeExecutionHostId, toSshExecutionHostId } from '../../../shared/execution-host'
|
||||
import { hostWorktreeTarget } from '../../../shared/worktree/host-qualified-identity'
|
||||
import { removeWorktreeMetaRow } from '../host-qualified-worktree-meta'
|
||||
|
||||
const { loadUserSshConfigMock, sshConfigHostsToTargetsMock } = vi.hoisted(() => ({
|
||||
loadUserSshConfigMock: vi.fn(),
|
||||
sshConfigHostsToTargetsMock: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('./ssh/config/ssh-config-parser', () => ({
|
||||
vi.mock('../../ssh/config/ssh-config-parser', () => ({
|
||||
loadUserSshConfig: loadUserSshConfigMock,
|
||||
sshConfigHostsToTargets: sshConfigHostsToTargetsMock
|
||||
}))
|
||||
@@ -46,11 +46,11 @@ vi.mock('electron', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('./telemetry/client', () => ({
|
||||
vi.mock('../../telemetry/client', () => ({
|
||||
track: trackMock
|
||||
}))
|
||||
|
||||
vi.mock('./telemetry/cohort-classifier', () => ({
|
||||
vi.mock('../../telemetry/cohort-classifier', () => ({
|
||||
getCohortAtEmit: getCohortAtEmitMock
|
||||
}))
|
||||
|
||||
+5
-3
@@ -2,10 +2,12 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { mkdtempSync, rmSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { closeTestStores, testState, createStore, makeRepo } from './persistence-test-harness'
|
||||
import { closeTestStores, testState, createStore, makeRepo } from '../../persistence-test-harness'
|
||||
vi.mock('electron', () => ({ app: { getPath: () => testState.dir } }))
|
||||
vi.mock('./telemetry/client', () => ({ track: vi.fn() }))
|
||||
vi.mock('./telemetry/cohort-classifier', () => ({ getCohortAtEmit: () => ({ nth_repo_added: 2 }) }))
|
||||
vi.mock('../../telemetry/client', () => ({ track: vi.fn() }))
|
||||
vi.mock('../../telemetry/cohort-classifier', () => ({
|
||||
getCohortAtEmit: () => ({ nth_repo_added: 2 })
|
||||
}))
|
||||
const project = { id: '10', key: 'ALP', name: 'Alpha', siteId: 'site-a' }
|
||||
describe('persisted repository Jira defaults', () => {
|
||||
beforeEach(() => {
|
||||
+3
-3
@@ -2,10 +2,10 @@ import { mkdtempSync, rmSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
|
||||
import { closeTestStores, createStore, testState } from './persistence-test-harness'
|
||||
import { normalizeJiraSavedFilterState } from '../shared/jira/jira-saved-filters'
|
||||
import { closeTestStores, createStore, testState } from '../../persistence-test-harness'
|
||||
import { normalizeJiraSavedFilterState } from '../../../shared/jira/jira-saved-filters'
|
||||
vi.mock('electron', () => ({ app: { getPath: () => testState.dir } }))
|
||||
vi.mock('./telemetry/client', () => ({ track: vi.fn() }))
|
||||
vi.mock('../../telemetry/client', () => ({ track: vi.fn() }))
|
||||
beforeEach(() => {
|
||||
testState.dir = mkdtempSync(join(tmpdir(), 'orca-jira-saved-filters-'))
|
||||
})
|
||||
+13
-8
@@ -1,20 +1,25 @@
|
||||
import { closeTestStores, createStore, testState, writeDataFile } from './persistence-test-harness'
|
||||
import {
|
||||
closeTestStores,
|
||||
createStore,
|
||||
testState,
|
||||
writeDataFile
|
||||
} from '../../persistence-test-harness'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { mkdtempSync, rmSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { tmpdir } from 'node:os'
|
||||
import type { Automation } from '../shared/automations-types'
|
||||
import type { Repo } from '../shared/repo-types'
|
||||
import { getDefaultPersistedState } from '../shared/constants'
|
||||
import { resolveAutomationRunTarget } from './automations/run-target-resolution'
|
||||
import { AutomationService } from './automations/service'
|
||||
import type { Automation } from '../../../shared/automations-types'
|
||||
import type { Repo } from '../../../shared/repo-types'
|
||||
import { getDefaultPersistedState } from '../../../shared/constants'
|
||||
import { resolveAutomationRunTarget } from '../../automations/run-target-resolution'
|
||||
import { AutomationService } from '../../automations/service'
|
||||
|
||||
vi.mock('electron', () => ({
|
||||
app: { getPath: () => testState.dir },
|
||||
safeStorage: { isEncryptionAvailable: () => false }
|
||||
}))
|
||||
vi.mock('./telemetry/client', () => ({ track: vi.fn() }))
|
||||
vi.mock('./telemetry/cohort-classifier', () => ({ getCohortAtEmit: vi.fn() }))
|
||||
vi.mock('../../telemetry/client', () => ({ track: vi.fn() }))
|
||||
vi.mock('../../telemetry/cohort-classifier', () => ({ getCohortAtEmit: vi.fn() }))
|
||||
|
||||
const localRow: Repo = {
|
||||
id: 'twin',
|
||||
+7
-2
@@ -1,4 +1,9 @@
|
||||
import { closeTestStores, testState, createStore, readDataFile } from './persistence-test-harness'
|
||||
import {
|
||||
closeTestStores,
|
||||
testState,
|
||||
createStore,
|
||||
readDataFile
|
||||
} from '../../persistence-test-harness'
|
||||
import { afterEach, beforeEach, expect, it, vi } from 'vitest'
|
||||
import { mkdtempSync, rmSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
@@ -8,7 +13,7 @@ vi.mock('electron', () => ({
|
||||
app: { getPath: () => testState.dir },
|
||||
safeStorage: { isEncryptionAvailable: () => false }
|
||||
}))
|
||||
vi.mock('./telemetry/client', () => ({ track: vi.fn() }))
|
||||
vi.mock('../../telemetry/client', () => ({ track: vi.fn() }))
|
||||
|
||||
beforeEach(() => {
|
||||
testState.dir = mkdtempSync(join(tmpdir(), 'orca-chat-appearance-'))
|
||||
+4
-4
@@ -4,7 +4,7 @@ import {
|
||||
createStore,
|
||||
writeDataFile,
|
||||
makeRepo
|
||||
} from './persistence-test-harness'
|
||||
} from '../../persistence-test-harness'
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { rmSync, mkdtempSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
@@ -15,7 +15,7 @@ const { loadUserSshConfigMock, sshConfigHostsToTargetsMock } = vi.hoisted(() =>
|
||||
sshConfigHostsToTargetsMock: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('./ssh/config/ssh-config-parser', () => ({
|
||||
vi.mock('../../ssh/config/ssh-config-parser', () => ({
|
||||
loadUserSshConfig: loadUserSshConfigMock,
|
||||
sshConfigHostsToTargets: sshConfigHostsToTargetsMock
|
||||
}))
|
||||
@@ -41,11 +41,11 @@ vi.mock('electron', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('./telemetry/client', () => ({
|
||||
vi.mock('../../telemetry/client', () => ({
|
||||
track: trackMock
|
||||
}))
|
||||
|
||||
vi.mock('./telemetry/cohort-classifier', () => ({
|
||||
vi.mock('../../telemetry/cohort-classifier', () => ({
|
||||
getCohortAtEmit: getCohortAtEmitMock
|
||||
}))
|
||||
|
||||
+5
-5
@@ -4,23 +4,23 @@ import {
|
||||
createStore,
|
||||
readDataFile,
|
||||
writeDataFile
|
||||
} from './persistence-test-harness'
|
||||
} from '../../persistence-test-harness'
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { mkdtempSync, rmSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { getDefaultPersistedState } from '../shared/constants'
|
||||
import { getDefaultPersistedState } from '../../../shared/constants'
|
||||
import type {
|
||||
NativeChatUpgradeTipAudience,
|
||||
NativeChatUpgradeTipVariant
|
||||
} from '../shared/native-chat-upgrade-tip-audience'
|
||||
import { normalizeProfileProjectState } from './orca-profiles/profile-project-state-file'
|
||||
} from '../../../shared/native-chat-upgrade-tip-audience'
|
||||
import { normalizeProfileProjectState } from '../../orca-profiles/profile-project-state-file'
|
||||
|
||||
vi.mock('electron', () => ({
|
||||
app: { getPath: () => testState.dir },
|
||||
safeStorage: { isEncryptionAvailable: () => false }
|
||||
}))
|
||||
vi.mock('./telemetry/client', () => ({ track: vi.fn() }))
|
||||
vi.mock('../../telemetry/client', () => ({ track: vi.fn() }))
|
||||
|
||||
beforeEach(() => {
|
||||
testState.dir = mkdtempSync(join(tmpdir(), 'orca-chat-upgrade-tip-audience-'))
|
||||
+1
-1
@@ -8,7 +8,7 @@ import {
|
||||
readPersistedStateJson,
|
||||
testState,
|
||||
writeDataFile
|
||||
} from './persistence-test-harness'
|
||||
} from '../../persistence-test-harness'
|
||||
|
||||
const plugin = 'plugin:stablyai.orca-portuguese/pt-BR'
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ vi.mock('electron', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
import { normalizeRightSidebarTab } from './persistence'
|
||||
import { normalizeRightSidebarTab } from './ui-selection-normalization'
|
||||
|
||||
describe('normalizeRightSidebarTab', () => {
|
||||
it.each(['explorer', 'search', 'vault', 'workspaces', 'source-control', 'checks', 'ports'])(
|
||||
+8
-8
@@ -5,22 +5,22 @@ import {
|
||||
withPlatform,
|
||||
writeDataFile,
|
||||
readDataFile
|
||||
} from './persistence-test-harness'
|
||||
} from '../../persistence-test-harness'
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { rmSync, mkdtempSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { tmpdir } from 'node:os'
|
||||
import type { GlobalSettings } from '../shared/global-settings-types'
|
||||
import type { PersistedState } from '../shared/persisted-state-types'
|
||||
import { getDefaultPersistedState } from '../shared/constants'
|
||||
import { ONBOARDING_FINAL_STEP, ONBOARDING_FLOW_VERSION } from '../shared/onboarding-defaults'
|
||||
import type { GlobalSettings } from '../../../shared/global-settings-types'
|
||||
import type { PersistedState } from '../../../shared/persisted-state-types'
|
||||
import { getDefaultPersistedState } from '../../../shared/constants'
|
||||
import { ONBOARDING_FINAL_STEP, ONBOARDING_FLOW_VERSION } from '../../../shared/onboarding-defaults'
|
||||
|
||||
const { loadUserSshConfigMock, sshConfigHostsToTargetsMock } = vi.hoisted(() => ({
|
||||
loadUserSshConfigMock: vi.fn(),
|
||||
sshConfigHostsToTargetsMock: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('./ssh/config/ssh-config-parser', () => ({
|
||||
vi.mock('../../ssh/config/ssh-config-parser', () => ({
|
||||
loadUserSshConfig: loadUserSshConfigMock,
|
||||
sshConfigHostsToTargets: sshConfigHostsToTargetsMock
|
||||
}))
|
||||
@@ -46,11 +46,11 @@ vi.mock('electron', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('./telemetry/client', () => ({
|
||||
vi.mock('../../telemetry/client', () => ({
|
||||
track: trackMock
|
||||
}))
|
||||
|
||||
vi.mock('./telemetry/cohort-classifier', () => ({
|
||||
vi.mock('../../telemetry/cohort-classifier', () => ({
|
||||
getCohortAtEmit: getCohortAtEmitMock
|
||||
}))
|
||||
|
||||
+11
-11
@@ -1,4 +1,4 @@
|
||||
import { composeAgentLaunchProfile } from '../shared/tui-agent-launch-defaults'
|
||||
import { composeAgentLaunchProfile } from '../../../shared/tui-agent-launch-defaults'
|
||||
import {
|
||||
closeTestStores,
|
||||
testState,
|
||||
@@ -6,28 +6,28 @@ import {
|
||||
writeDataFile,
|
||||
readDataFile,
|
||||
collectPropertyPaths,
|
||||
makeRepo,
|
||||
makeTerminalTab
|
||||
} from './persistence-test-harness'
|
||||
makeRepo
|
||||
} from '../../persistence-test-harness'
|
||||
import { makeTerminalTab } from '../../persistence-session-fixtures'
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { writeFileSync, rmSync, mkdtempSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { tmpdir } from 'node:os'
|
||||
import type { GlobalSettings } from '../shared/global-settings-types'
|
||||
import type { PersistedState } from '../shared/persisted-state-types'
|
||||
import { getDefaultWorkspaceSession } from '../shared/constants'
|
||||
import type { GlobalSettings } from '../../../shared/global-settings-types'
|
||||
import type { PersistedState } from '../../../shared/persisted-state-types'
|
||||
import { getDefaultWorkspaceSession } from '../../../shared/constants'
|
||||
|
||||
import {
|
||||
getLocalWorktreeScanGeneration,
|
||||
isLocalWorktreeScanGenerationCurrent
|
||||
} from './local-worktree-scan-generation'
|
||||
} from '../../local-worktree-scan-generation'
|
||||
|
||||
const { loadUserSshConfigMock, sshConfigHostsToTargetsMock } = vi.hoisted(() => ({
|
||||
loadUserSshConfigMock: vi.fn(),
|
||||
sshConfigHostsToTargetsMock: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('./ssh/config/ssh-config-parser', () => ({
|
||||
vi.mock('../../ssh/config/ssh-config-parser', () => ({
|
||||
loadUserSshConfig: loadUserSshConfigMock,
|
||||
sshConfigHostsToTargets: sshConfigHostsToTargetsMock
|
||||
}))
|
||||
@@ -53,11 +53,11 @@ vi.mock('electron', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('./telemetry/client', () => ({
|
||||
vi.mock('../../telemetry/client', () => ({
|
||||
track: trackMock
|
||||
}))
|
||||
|
||||
vi.mock('./telemetry/cohort-classifier', () => ({
|
||||
vi.mock('../../telemetry/cohort-classifier', () => ({
|
||||
getCohortAtEmit: getCohortAtEmitMock
|
||||
}))
|
||||
|
||||
+6
-6
@@ -7,20 +7,20 @@ import {
|
||||
readDataFile,
|
||||
readPersistedStateJson,
|
||||
makeRepo
|
||||
} from './persistence-test-harness'
|
||||
} from '../../persistence-test-harness'
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { writeFileSync, readFileSync, rmSync, mkdtempSync, mkdirSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { tmpdir } from 'node:os'
|
||||
import type { PersistedState } from '../shared/persisted-state-types'
|
||||
import { setSourceControlActionDefault } from '../shared/source-control-ai-actions'
|
||||
import type { PersistedState } from '../../../shared/persisted-state-types'
|
||||
import { setSourceControlActionDefault } from '../../../shared/source-control-ai-actions'
|
||||
|
||||
const { loadUserSshConfigMock, sshConfigHostsToTargetsMock } = vi.hoisted(() => ({
|
||||
loadUserSshConfigMock: vi.fn(),
|
||||
sshConfigHostsToTargetsMock: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('./ssh/config/ssh-config-parser', () => ({
|
||||
vi.mock('../../ssh/config/ssh-config-parser', () => ({
|
||||
loadUserSshConfig: loadUserSshConfigMock,
|
||||
sshConfigHostsToTargets: sshConfigHostsToTargetsMock
|
||||
}))
|
||||
@@ -46,11 +46,11 @@ vi.mock('electron', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
vi.mock('./telemetry/client', () => ({
|
||||
vi.mock('../../telemetry/client', () => ({
|
||||
track: trackMock
|
||||
}))
|
||||
|
||||
vi.mock('./telemetry/cohort-classifier', () => ({
|
||||
vi.mock('../../telemetry/cohort-classifier', () => ({
|
||||
getCohortAtEmit: getCohortAtEmitMock
|
||||
}))
|
||||
|
||||
+3
-3
@@ -2,20 +2,20 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { mkdtempSync, rmSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { getDefaultPersistedState } from '../shared/constants'
|
||||
import { getDefaultPersistedState } from '../../../shared/constants'
|
||||
import {
|
||||
closeTestStores,
|
||||
testState,
|
||||
createStore,
|
||||
readDataFile,
|
||||
writeDataFile
|
||||
} from './persistence-test-harness'
|
||||
} from '../../persistence-test-harness'
|
||||
|
||||
vi.mock('electron', () => ({
|
||||
app: { getPath: () => testState.dir },
|
||||
safeStorage: { isEncryptionAvailable: () => false }
|
||||
}))
|
||||
vi.mock('./telemetry/client', () => ({ track: vi.fn() }))
|
||||
vi.mock('../../telemetry/client', () => ({ track: vi.fn() }))
|
||||
|
||||
beforeEach(() => {
|
||||
testState.dir = mkdtempSync(join(tmpdir(), 'orca-compact-notice-'))
|
||||
+11
-10
@@ -2,9 +2,9 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
|
||||
import { rmSync, mkdtempSync } from 'node:fs'
|
||||
import { join } from 'node:path'
|
||||
import { tmpdir } from 'node:os'
|
||||
import type { PersistedState } from '../shared/persisted-state-types'
|
||||
import { getDefaultPersistedState } from '../shared/constants'
|
||||
import { createDefaultWorkspaceCleanupBrowseState } from '../shared/workspace-cleanup-browse-state'
|
||||
import type { PersistedState } from '../../../shared/persisted-state-types'
|
||||
import { getDefaultPersistedState } from '../../../shared/constants'
|
||||
import { createDefaultWorkspaceCleanupBrowseState } from '../../../shared/workspace-cleanup-browse-state'
|
||||
import {
|
||||
closeTestStores,
|
||||
createSqliteTestStore,
|
||||
@@ -15,15 +15,15 @@ import {
|
||||
writeDataFile,
|
||||
readDataFile,
|
||||
makeRepo
|
||||
} from './persistence-test-harness'
|
||||
import { installFakeAppEnvironment } from '../../config/scripts/vitest-host-ports-setup'
|
||||
} from '../../persistence-test-harness'
|
||||
import { installFakeAppEnvironment } from '../../../../config/scripts/vitest-host-ports-setup'
|
||||
|
||||
const { loadUserSshConfigMock, sshConfigHostsToTargetsMock } = vi.hoisted(() => ({
|
||||
loadUserSshConfigMock: vi.fn(),
|
||||
sshConfigHostsToTargetsMock: vi.fn()
|
||||
}))
|
||||
|
||||
vi.mock('./ssh/config/ssh-config-parser', () => ({
|
||||
vi.mock('../../ssh/config/ssh-config-parser', () => ({
|
||||
loadUserSshConfig: loadUserSshConfigMock,
|
||||
sshConfigHostsToTargets: sshConfigHostsToTargetsMock
|
||||
}))
|
||||
@@ -44,7 +44,7 @@ async function createStore() {
|
||||
if (hasCreatedStoreInCase) {
|
||||
vi.resetModules()
|
||||
}
|
||||
const { setSecretStore } = await import('../shared/secret-store')
|
||||
const { setSecretStore } = await import('../../../shared/secret-store')
|
||||
setSecretStore({
|
||||
isEncryptionAvailable: () => true,
|
||||
encryptString: (plaintext) => Buffer.from(`encrypted:${plaintext}`, 'utf-8'),
|
||||
@@ -61,18 +61,19 @@ async function createStore() {
|
||||
hasCreatedStoreInCase = true
|
||||
return createFreshStore()
|
||||
}
|
||||
const { Store, initDataPath } = await import('./persistence')
|
||||
const { Store } = await import('../loading-store/store')
|
||||
const { initDataPath } = await import('../loading-store/user-data-path')
|
||||
// Reinstall this test’s userData path after resetModules before initializing Store.
|
||||
installFakeAppEnvironment({ getPath: () => testState.dir })
|
||||
initDataPath()
|
||||
return createSqliteTestStore(Store, { dataFile: join(testState.dir, 'orca-data.json') })
|
||||
}
|
||||
|
||||
vi.mock('./telemetry/client', () => ({
|
||||
vi.mock('../../telemetry/client', () => ({
|
||||
track: trackMock
|
||||
}))
|
||||
|
||||
vi.mock('./telemetry/cohort-classifier', () => ({
|
||||
vi.mock('../../telemetry/cohort-classifier', () => ({
|
||||
getCohortAtEmit: getCohortAtEmitMock
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user