mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-19 22:09:37 +00:00
fix: mock useConcurrentExecution in executionStore tests and enable flag for concurrent test suites
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { setActivePinia } from 'pinia'
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { ref } from 'vue'
|
||||
import { app } from '@/scripts/app'
|
||||
import { MAX_PROGRESS_JOBS, useExecutionStore } from '@/stores/executionStore'
|
||||
import { useExecutionErrorStore } from '@/stores/executionErrorStore'
|
||||
@@ -15,6 +16,20 @@ import type { NodeProgressState } from '@/schemas/apiSchema'
|
||||
import { createMockLGraphNode } from '@/utils/__tests__/litegraphTestUtils'
|
||||
import { createTestingPinia } from '@pinia/testing'
|
||||
|
||||
const mockConcurrentExecutionEnabled = ref(false)
|
||||
|
||||
vi.mock('@/composables/useConcurrentExecution', () => ({
|
||||
useConcurrentExecution: () => ({
|
||||
isConcurrentExecutionEnabled: mockConcurrentExecutionEnabled,
|
||||
isFeatureEnabled: ref(false),
|
||||
isUserEnabled: ref(false),
|
||||
maxConcurrentJobs: ref(1),
|
||||
hasSeenOnboarding: ref(false),
|
||||
setUserEnabled: vi.fn(),
|
||||
markOnboardingSeen: vi.fn()
|
||||
})
|
||||
}))
|
||||
|
||||
// Mock the workflowStore
|
||||
vi.mock('@/platform/workflow/management/stores/workflowStore', async () => {
|
||||
const { ComfyWorkflow } = await vi.importActual<typeof WorkflowStoreModule>(
|
||||
@@ -582,6 +597,7 @@ describe('useExecutionStore - isIdle with multi-job', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
mockConcurrentExecutionEnabled.value = true
|
||||
setActivePinia(createTestingPinia({ stubActions: false }))
|
||||
store = useExecutionStore()
|
||||
})
|
||||
@@ -700,6 +716,7 @@ describe('useExecutionStore - executionProgress from focusedJob', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
mockConcurrentExecutionEnabled.value = true
|
||||
setActivePinia(createTestingPinia({ stubActions: false }))
|
||||
store = useExecutionStore()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user