refactor: define types for mockCommandStore and mockSelectionState in BypassButton tests

This commit is contained in:
Johnpaul
2025-09-10 02:21:04 +01:00
parent 3b230ed472
commit ca23170e6d

View File

@@ -35,9 +35,18 @@ describe('BypassButton', () => {
}
})
// Mock interfaces
interface MockCommandStore {
execute: ReturnType<typeof vi.fn>
}
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<typeof useCommandStore>
)
// Setup mock selection state
mockSelectionState = {
hasAnySelection: ref(true)
}
vi.mocked(useSelectionState).mockReturnValue(mockSelectionState)
vi.mocked(useSelectionState).mockReturnValue(
mockSelectionState as unknown as ReturnType<typeof useSelectionState>
)
})
const mountComponent = () => {