mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-05 07:30:11 +00:00
[manager] Fix test failures and missing type definitions
- Fix ManagerProgressDialogContent test mock to include all required store methods - Add missing MergedNodePack, RegistryPack type definitions and isMergedNodePack type guard - Ensure all unit tests (548 passed) and component tests (174 passed) are working - Fix TypeScript compilation errors related to manager store interfaces
This commit is contained in:
@@ -30,11 +30,20 @@ const defaultMockTaskLogs = [
|
||||
|
||||
vi.mock('@/stores/comfyManagerStore', () => ({
|
||||
useComfyManagerStore: vi.fn(() => ({
|
||||
taskLogs: [...defaultMockTaskLogs]
|
||||
taskLogs: [...defaultMockTaskLogs],
|
||||
succeededTasksLogs: [...defaultMockTaskLogs],
|
||||
failedTasksLogs: [...defaultMockTaskLogs],
|
||||
managerQueue: { historyCount: 2 },
|
||||
isLoading: false
|
||||
})),
|
||||
useManagerProgressDialogStore: vi.fn(() => ({
|
||||
isExpanded: true,
|
||||
collapse: mockCollapse
|
||||
activeTabIndex: 0,
|
||||
getActiveTabIndex: vi.fn(() => 0),
|
||||
setActiveTabIndex: vi.fn(),
|
||||
toggle: vi.fn(),
|
||||
collapse: mockCollapse,
|
||||
expand: vi.fn()
|
||||
}))
|
||||
}))
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import type { InjectionKey, Ref } from 'vue'
|
||||
|
||||
import type { AlgoliaNodePack } from '@/types/algoliaTypes'
|
||||
import type { components } from '@/types/comfyRegistryTypes'
|
||||
|
||||
export const IsInstallingKey: InjectionKey<Ref<boolean>> =
|
||||
Symbol('isInstalling')
|
||||
|
||||
@@ -40,3 +43,19 @@ export interface UseNodePacksOptions {
|
||||
immediate?: boolean
|
||||
maxConcurrent?: number
|
||||
}
|
||||
|
||||
// Node pack types from different sources
|
||||
export type RegistryPack = components['schemas']['Node']
|
||||
|
||||
// MergedNodePack is the intersection of AlgoliaNodePack and RegistryPack
|
||||
// created by lodash merge operation: merge({}, algoliaNodePack, registryPack)
|
||||
export type MergedNodePack = AlgoliaNodePack & RegistryPack
|
||||
|
||||
/**
|
||||
* Type guard to check if a node pack is from Algolia (has comfy_nodes)
|
||||
*/
|
||||
export function isMergedNodePack(
|
||||
pack: MergedNodePack | RegistryPack
|
||||
): pack is MergedNodePack {
|
||||
return 'comfy_nodes' in pack && Array.isArray(pack.comfy_nodes)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user