From 8f7808642acf442f0668ee8d57f836e9fa51d917 Mon Sep 17 00:00:00 2001 From: Molecule AI App-FE Date: Thu, 23 Apr 2026 16:42:32 +0000 Subject: [PATCH] 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 --- .../src/components/__tests__/ContextMenu.keyboard.test.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/canvas/src/components/__tests__/ContextMenu.keyboard.test.tsx b/canvas/src/components/__tests__/ContextMenu.keyboard.test.tsx index 085db159..6ce3ffb0 100644 --- a/canvas/src/components/__tests__/ContextMenu.keyboard.test.tsx +++ b/canvas/src/components/__tests__/ContextMenu.keyboard.test.tsx @@ -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 } ), }));