From ca23170e6d93e98c6cfc202a8b4228aa31d64436 Mon Sep 17 00:00:00 2001 From: Johnpaul Date: Wed, 10 Sep 2025 02:21:04 +0100 Subject: [PATCH] refactor: define types for mockCommandStore and mockSelectionState in BypassButton tests --- .../selectionToolbox/BypassButton.test.ts | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/components/graph/selectionToolbox/BypassButton.test.ts b/src/components/graph/selectionToolbox/BypassButton.test.ts index b77925575..f9670226a 100644 --- a/src/components/graph/selectionToolbox/BypassButton.test.ts +++ b/src/components/graph/selectionToolbox/BypassButton.test.ts @@ -35,9 +35,18 @@ describe('BypassButton', () => { } }) + // Mock interfaces + interface MockCommandStore { + execute: ReturnType + } + + interface MockSelectionState { + hasAnySelection: { value: boolean } + } + // Mock instances - let mockCommandStore: any - let mockSelectionState: any + let mockCommandStore: MockCommandStore + let mockSelectionState: MockSelectionState beforeEach(() => { vi.clearAllMocks() @@ -46,13 +55,17 @@ describe('BypassButton', () => { mockCommandStore = { execute: vi.fn().mockResolvedValue(undefined) } - vi.mocked(useCommandStore).mockReturnValue(mockCommandStore) + vi.mocked(useCommandStore).mockReturnValue( + mockCommandStore as unknown as ReturnType + ) // Setup mock selection state mockSelectionState = { hasAnySelection: ref(true) } - vi.mocked(useSelectionState).mockReturnValue(mockSelectionState) + vi.mocked(useSelectionState).mockReturnValue( + mockSelectionState as unknown as ReturnType + ) }) const mountComponent = () => {