fix: mock useConcurrentExecution in executionStore tests and enable flag for concurrent test suites

This commit is contained in:
bymyself
2026-03-15 05:08:04 -07:00
parent 60d93ab847
commit 2f80d4fc54

View File

@@ -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()
})