refactor: remove any types from batch 16 test files (6 instances)

Fixed 6 'as any' instances across 2 files:
- subgraphStore.test.ts: Used ReturnType for getUserData mock and ExportedSubgraph for subgraph serialization
- modelToNodeStore.test.ts: Used proper type casts for invalid input test cases
This commit is contained in:
Johnpaul
2026-01-22 22:39:13 +01:00
parent cc6da76aa9
commit cbd5e7fed3
2 changed files with 7 additions and 6 deletions

View File

@@ -189,7 +189,7 @@ describe('useModelToNodeStore', () => {
it('should not register provider when nodeDef is undefined', () => {
const modelToNodeStore = useModelToNodeStore()
const providerWithoutNodeDef = new ModelNodeProvider(
undefined as any,
undefined as unknown as ComfyNodeDefImpl,
'custom_key'
)
@@ -458,13 +458,13 @@ describe('useModelToNodeStore', () => {
// These should not throw but return undefined
expect(
modelToNodeStore.getCategoryForNodeType(null as any)
modelToNodeStore.getCategoryForNodeType(null as unknown as string)
).toBeUndefined()
expect(
modelToNodeStore.getCategoryForNodeType(undefined as any)
modelToNodeStore.getCategoryForNodeType(undefined as unknown as string)
).toBeUndefined()
expect(
modelToNodeStore.getCategoryForNodeType(123 as any)
modelToNodeStore.getCategoryForNodeType(123 as unknown as string)
).toBeUndefined()
})

View File

@@ -1,6 +1,7 @@
import { createPinia, setActivePinia } from 'pinia'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import type { ExportedSubgraph } from '@/lib/litegraph/src/litegraph'
import type { ComfyNodeDef as ComfyNodeDefV1 } from '@/schemas/nodeDefSchema'
import { api } from '@/scripts/api'
import { app as comfyApp } from '@/scripts/app'
@@ -72,7 +73,7 @@ describe('useSubgraphStore', () => {
({
status: 200,
text: () => JSON.stringify(filenames[f.slice(10)])
}) as any
}) as unknown as ReturnType<typeof api.getUserData>
)
return await store.fetchSubgraphs()
}
@@ -92,7 +93,7 @@ describe('useSubgraphStore', () => {
vi.mocked(comfyApp.canvas).selectedItems = new Set([subgraphNode])
vi.mocked(comfyApp.canvas)._serializeItems = vi.fn(() => ({
nodes: [subgraphNode.serialize()],
subgraphs: [subgraph.serialize() as any]
subgraphs: [subgraph.serialize() as unknown as ExportedSubgraph]
}))
//mock saving of file
vi.mocked(api.storeUserData).mockResolvedValue({