mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-04 23:20:07 +00:00
test: remove explicit any types from useCoreCommands.test.ts
Removed all 3 any types and replaced with proper TypeScript types. Changes: - Replaced as any with Partial<ReturnType<typeof useSettingStore>> - Used as unknown as for partial mock subgraph (114+ missing properties) All tests passing (3/3), 0 typecheck errors. Part of #8092
This commit is contained in:
@@ -144,7 +144,9 @@ describe('useCoreCommands', () => {
|
||||
// Mock settings store
|
||||
vi.mocked(useSettingStore).mockReturnValue({
|
||||
get: vi.fn().mockReturnValue(false) // Skip confirmation dialog
|
||||
} as any)
|
||||
} as Partial<ReturnType<typeof useSettingStore>> as ReturnType<
|
||||
typeof useSettingStore
|
||||
>)
|
||||
|
||||
// Mock global confirm
|
||||
global.confirm = vi.fn().mockReturnValue(true)
|
||||
@@ -167,7 +169,8 @@ describe('useCoreCommands', () => {
|
||||
|
||||
it('should preserve input/output nodes when clearing subgraph', async () => {
|
||||
// Set up subgraph context
|
||||
app.canvas.subgraph = mockSubgraph as any
|
||||
app.canvas.subgraph =
|
||||
mockSubgraph as unknown as typeof app.canvas.subgraph
|
||||
|
||||
const commands = useCoreCommands()
|
||||
const clearCommand = commands.find(
|
||||
@@ -198,7 +201,9 @@ describe('useCoreCommands', () => {
|
||||
// Mock confirmation required
|
||||
vi.mocked(useSettingStore).mockReturnValue({
|
||||
get: vi.fn().mockReturnValue(true) // Require confirmation
|
||||
} as any)
|
||||
} as Partial<ReturnType<typeof useSettingStore>> as ReturnType<
|
||||
typeof useSettingStore
|
||||
>)
|
||||
|
||||
global.confirm = vi.fn().mockReturnValue(false) // User cancels
|
||||
|
||||
|
||||
Reference in New Issue
Block a user