From 1a0a1e79634c6842aa5803213e766e4c01400f02 Mon Sep 17 00:00:00 2001 From: Ash Date: Thu, 24 Oct 2024 21:08:08 +0100 Subject: [PATCH] test(sanity): mock `router.perspectiveState` --- .../perspective/__tests__/DocumentPerspectiveMenu.test.tsx | 1 + .../panes/documentList/__tests__/PaneContainer.test.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/__tests__/DocumentPerspectiveMenu.test.tsx b/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/__tests__/DocumentPerspectiveMenu.test.tsx index e47843375eb2..3dcd393c85b7 100644 --- a/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/__tests__/DocumentPerspectiveMenu.test.tsx +++ b/packages/sanity/src/structure/panes/document/documentPanel/header/perspective/__tests__/DocumentPerspectiveMenu.test.tsx @@ -34,6 +34,7 @@ vi.mock('sanity/router', () => { return { useRouter: vi.fn().mockReturnValue({ stickyParams: {}, + perspectiveState: {}, }), route: { create: vi.fn(), diff --git a/packages/sanity/src/structure/panes/documentList/__tests__/PaneContainer.test.tsx b/packages/sanity/src/structure/panes/documentList/__tests__/PaneContainer.test.tsx index 13cece67db2a..6c1c1b4d7c4e 100644 --- a/packages/sanity/src/structure/panes/documentList/__tests__/PaneContainer.test.tsx +++ b/packages/sanity/src/structure/panes/documentList/__tests__/PaneContainer.test.tsx @@ -30,7 +30,12 @@ vi.mock('sanity', async (importOriginal) => ({ })) vi.mock('sanity/router', async (importOriginal) => ({ ...(await importOriginal()), - useRouter: vi.fn().mockReturnValue({stickyParams: {}, state: {}, navigate: vi.fn()}), + useRouter: vi.fn().mockReturnValue({ + stickyParams: {}, + state: {}, + navigate: vi.fn(), + perspectiveState: {}, + }), })) const mockUseSearchState = useSearchState as Mock