From b7f23590972deb8d142f6d6140d10b7fc393327c Mon Sep 17 00:00:00 2001 From: Johnpaul Date: Wed, 21 Jan 2026 03:04:43 +0100 Subject: [PATCH] test: remove any from SubgraphSlotVisualFeedback.test.ts - Replace mockColorContext: any with proper MockColorContext interface - Apply double-cast at draw() call sites to satisfy DefaultConnectionColors type - Pattern: colorContext: mockColorContext as unknown as DefaultConnectionColors --- .../SubgraphSlotVisualFeedback.test.ts | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/lib/litegraph/src/subgraph/SubgraphSlotVisualFeedback.test.ts b/src/lib/litegraph/src/subgraph/SubgraphSlotVisualFeedback.test.ts index baf842812..37ef9ec31 100644 --- a/src/lib/litegraph/src/subgraph/SubgraphSlotVisualFeedback.test.ts +++ b/src/lib/litegraph/src/subgraph/SubgraphSlotVisualFeedback.test.ts @@ -1,13 +1,21 @@ // TODO: Fix these tests after migration import { beforeEach, describe, expect, it, vi } from 'vitest' +import type { DefaultConnectionColors } from '@/lib/litegraph/src/interfaces' import { LGraphNode } from '@/lib/litegraph/src/litegraph' import { createTestSubgraph } from './__fixtures__/subgraphHelpers' +interface MockColorContext { + defaultInputColor: string + defaultOutputColor: string + getConnectedColor: ReturnType + getDisconnectedColor: ReturnType +} + describe.skip('SubgraphSlot visual feedback', () => { let mockCtx: CanvasRenderingContext2D - let mockColorContext: any + let mockColorContext: MockColorContext let globalAlphaValues: number[] beforeEach(() => { @@ -42,7 +50,7 @@ describe.skip('SubgraphSlot visual feedback', () => { defaultOutputColor: '#00FF00', getConnectedColor: vi.fn().mockReturnValue('#0000FF'), getDisconnectedColor: vi.fn().mockReturnValue('#AAAAAA') - } + } as unknown as MockColorContext }) it('should render SubgraphInput slots with full opacity when dragging from compatible slot', () => { @@ -60,7 +68,7 @@ describe.skip('SubgraphSlot visual feedback', () => { // Draw the slot with a compatible fromSlot subgraphInput.draw({ ctx: mockCtx, - colorContext: mockColorContext, + colorContext: mockColorContext as unknown as DefaultConnectionColors, fromSlot: nodeInput, editorAlpha: 1 }) @@ -80,7 +88,7 @@ describe.skip('SubgraphSlot visual feedback', () => { // Draw subgraphInput2 while dragging from subgraphInput1 (incompatible - both are outputs inside subgraph) subgraphInput2.draw({ ctx: mockCtx, - colorContext: mockColorContext, + colorContext: mockColorContext as unknown as DefaultConnectionColors, fromSlot: subgraphInput1, editorAlpha: 1 }) @@ -105,7 +113,7 @@ describe.skip('SubgraphSlot visual feedback', () => { // Draw the slot with a compatible fromSlot subgraphOutput.draw({ ctx: mockCtx, - colorContext: mockColorContext, + colorContext: mockColorContext as unknown as DefaultConnectionColors, fromSlot: nodeOutput, editorAlpha: 1 }) @@ -125,7 +133,7 @@ describe.skip('SubgraphSlot visual feedback', () => { // Draw subgraphOutput2 while dragging from subgraphOutput1 (incompatible - both are inputs inside subgraph) subgraphOutput2.draw({ ctx: mockCtx, - colorContext: mockColorContext, + colorContext: mockColorContext as unknown as DefaultConnectionColors, fromSlot: subgraphOutput1, editorAlpha: 1 }) @@ -170,7 +178,7 @@ describe.skip('SubgraphSlot visual feedback', () => { // Draw the SubgraphOutput slot while dragging from a node output with incompatible type subgraphOutput.draw({ ctx: mockCtx, - colorContext: mockColorContext, + colorContext: mockColorContext as unknown as DefaultConnectionColors, fromSlot: nodeStringOutput, editorAlpha: 1 })