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:
Johnpaul
2026-01-21 01:15:34 +01:00
parent 17bab4d413
commit 86cf60cb6c

View File

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