[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:
bymyself
2025-06-13 20:00:45 -07:00
committed by Jin Yi
parent a28aa80370
commit cc7c36620f
2 changed files with 30 additions and 2 deletions

View File

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

View File

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