mirror of
https://github.com/stablyai/orca.git
synced 2026-10-07 00:02:29 +00:00
fix(test): give async image-insert store mocks the openFiles list (#25357)
#25176 and #24489 landed together and collided in insertRichMarkdownImageFromPath. #25176 added three test files whose @/store mock returns { settings, folderWorkspaces, worktreesByRepo }. #24489 made the same function look up the open document with state.openFiles.find(...) to pass document-folder access to the import. Under the mock, openFiles is undefined, so the lookup throws, the catch shows "Failed to insert image", and no image is inserted -- 38 tests fail on main. The real store always carries openFiles, so production behavior of both PRs is intact; the mocks were just written against the pre-#24489 shape. Add openFiles: [] to the three mocks.
This commit is contained in:
@@ -17,7 +17,12 @@ vi.mock('@/runtime/runtime-file-client', () => ({ importExternalPathsToRuntime:
|
||||
vi.mock('@/lib/connection-context', () => ({ getConnectionId: vi.fn(() => null) }))
|
||||
vi.mock('@/store', () => ({
|
||||
useAppStore: {
|
||||
getState: vi.fn(() => ({ settings: null, folderWorkspaces: [], worktreesByRepo: {} }))
|
||||
getState: vi.fn(() => ({
|
||||
settings: null,
|
||||
folderWorkspaces: [],
|
||||
worktreesByRepo: {},
|
||||
openFiles: []
|
||||
}))
|
||||
}
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-rpc-client', () => ({
|
||||
|
||||
@@ -11,7 +11,12 @@ vi.mock('@/runtime/runtime-file-client', () => ({ importExternalPathsToRuntime:
|
||||
vi.mock('@/lib/connection-context', () => ({ getConnectionId: vi.fn(() => null) }))
|
||||
vi.mock('@/store', () => ({
|
||||
useAppStore: {
|
||||
getState: vi.fn(() => ({ settings: null, folderWorkspaces: [], worktreesByRepo: {} }))
|
||||
getState: vi.fn(() => ({
|
||||
settings: null,
|
||||
folderWorkspaces: [],
|
||||
worktreesByRepo: {},
|
||||
openFiles: []
|
||||
}))
|
||||
}
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-rpc-client', () => ({
|
||||
|
||||
@@ -13,7 +13,12 @@ vi.mock('@/runtime/runtime-file-client', () => ({ importExternalPathsToRuntime:
|
||||
vi.mock('@/lib/connection-context', () => ({ getConnectionId: vi.fn(() => null) }))
|
||||
vi.mock('@/store', () => ({
|
||||
useAppStore: {
|
||||
getState: vi.fn(() => ({ settings: null, folderWorkspaces: [], worktreesByRepo: {} }))
|
||||
getState: vi.fn(() => ({
|
||||
settings: null,
|
||||
folderWorkspaces: [],
|
||||
worktreesByRepo: {},
|
||||
openFiles: []
|
||||
}))
|
||||
}
|
||||
}))
|
||||
vi.mock('@/runtime/runtime-rpc-client', () => ({
|
||||
|
||||
Reference in New Issue
Block a user