mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
test: preserve stored workspace rows in orchestration fixture
Co-authored-by: Wooseong Kim <innocarpe@gmail.com>
This commit is contained in:
co-authored by
Wooseong Kim
parent
b5626421e0
commit
5b02fd7377
@@ -1,5 +1,7 @@
|
||||
import type * as WorktreeListingModule from '../../../git/worktrees/catalog/worktree-listing'
|
||||
import { randomUUID } from 'node:crypto'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { mergeWorktreeMetaForWrite } from '../../../persistence/loading-store/worktree-metadata/worktree-meta-write-normalization'
|
||||
|
||||
const electronMocks = vi.hoisted(() => {
|
||||
const ipcMain = {
|
||||
@@ -103,8 +105,12 @@ function makeStore(options: StoreOptions = {}) {
|
||||
],
|
||||
getAllWorktreeMeta: vi.fn(() => metaById),
|
||||
getWorktreeMeta: (id: string) => metaById[id],
|
||||
setWorktreeMeta: ({ id }: HostWorktreeTarget, meta: Partial<WorktreeMeta>) => {
|
||||
metaById[id] = { ...(metaById[id] ?? makeMeta()), ...meta }
|
||||
setWorktreeMeta: ({ id, hostId }: HostWorktreeTarget, meta: Partial<WorktreeMeta>) => {
|
||||
const existing = metaById[id]
|
||||
metaById[id] = mergeWorktreeMetaForWrite(existing, meta, {
|
||||
instanceId: meta.instanceId ?? existing?.instanceId ?? randomUUID(),
|
||||
hostId
|
||||
})
|
||||
return metaById[id]
|
||||
},
|
||||
removeWorktreeMeta: () => {},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import type * as RepoWorktreeResolutionScan from '../../src/main/runtime/workspaces/catalog/repo-worktree-resolution-scan'
|
||||
|
||||
const electronMocks = vi.hoisted(() => {
|
||||
const ipcMain = {
|
||||
@@ -16,9 +17,13 @@ const electronMocks = vi.hoisted(() => {
|
||||
vi.mock('electron', () => electronMocks)
|
||||
|
||||
const scanLocalRepoWorktreesForResolution = vi.hoisted(() => vi.fn())
|
||||
vi.mock('../../src/main/runtime/workspaces/catalog/repo-worktree-resolution-scan', () => ({
|
||||
scanLocalRepoWorktreesForResolution
|
||||
}))
|
||||
vi.mock(
|
||||
'../../src/main/runtime/workspaces/catalog/repo-worktree-resolution-scan',
|
||||
async (importOriginal) => ({
|
||||
...(await importOriginal<typeof RepoWorktreeResolutionScan>()),
|
||||
scanLocalRepoWorktreesForResolution
|
||||
})
|
||||
)
|
||||
|
||||
import '../../src/main/runtime/orchestration/db/contract-constants'
|
||||
import '../../src/main/runtime/orchestration/db/messages/mailbox-routing-page'
|
||||
|
||||
Reference in New Issue
Block a user