mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 03:01:54 +00:00
refactor: moving mock functions out of global
This commit is contained in:
@@ -17,16 +17,10 @@ const createMockRootGraph = (
|
|||||||
...options
|
...options
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create mock functions
|
|
||||||
const mockNodeExecutionIdToNodeLocatorId = vi.fn()
|
|
||||||
const mockNodeIdToNodeLocatorId = vi.fn()
|
|
||||||
const mockNodeLocatorIdToNodeExecutionId = vi.fn()
|
|
||||||
|
|
||||||
// Keep track of the current mock root graph
|
// Keep track of the current mock root graph
|
||||||
const mockAppState = {
|
const mockAppState = {
|
||||||
rootGraph: createMockRootGraph()
|
rootGraph: createMockRootGraph()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mock the app import and its rootGraph property
|
// Mock the app import and its rootGraph property
|
||||||
vi.mock('@/scripts/app', () => ({
|
vi.mock('@/scripts/app', () => ({
|
||||||
app: {
|
app: {
|
||||||
@@ -40,7 +34,6 @@ vi.mock('@/scripts/app', () => ({
|
|||||||
nodePreviewImages: {}
|
nodePreviewImages: {}
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// Mock the workflowStore
|
// Mock the workflowStore
|
||||||
vi.mock(
|
vi.mock(
|
||||||
'@/platform/workflow/management/stores/workflowStore',
|
'@/platform/workflow/management/stores/workflowStore',
|
||||||
@@ -49,6 +42,10 @@ vi.mock(
|
|||||||
await importOriginal<
|
await importOriginal<
|
||||||
typeof import('@/platform/workflow/management/stores/workflowStore')
|
typeof import('@/platform/workflow/management/stores/workflowStore')
|
||||||
>()
|
>()
|
||||||
|
const mockNodeExecutionIdToNodeLocatorId = vi.fn()
|
||||||
|
const mockNodeIdToNodeLocatorId = vi.fn()
|
||||||
|
const mockNodeLocatorIdToNodeExecutionId = vi.fn()
|
||||||
|
|
||||||
return {
|
return {
|
||||||
ComfyWorkflow,
|
ComfyWorkflow,
|
||||||
useWorkflowStore: vi.fn(() => ({
|
useWorkflowStore: vi.fn(() => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user