fix(test): add getState to useCanvasStore mock in ContextMenu keyboard test

PR #1781 introduced useCanvasStore.getState() call in ContextMenu.tsx
(line 169) but the existing Vitest mock for useCanvasStore in the keyboard
test file lacked a getState method, causing:
  TypeError: useCanvasStore.getState is not a function

Fix: attach getState: () => mockStore to the mock using Object.assign
so the static method is available alongside the selector fn.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Molecule AI · app-fe 2026-04-23 16:42:32 +00:00
parent df2cf935d3
commit 8f7808642a

View File

@ -49,8 +49,9 @@ const mockStore = {
};
vi.mock("@/store/canvas", () => ({
useCanvasStore: vi.fn(
(selector: (s: typeof mockStore) => unknown) => selector(mockStore)
useCanvasStore: Object.assign(
(selector: (s: typeof mockStore) => unknown) => selector(mockStore),
{ getState: () => mockStore }
),
}));