From 6c6064f38fd1220f6a3dafc36047ee6e5fa43dff Mon Sep 17 00:00:00 2001 From: Rocio De Santiago Date: Fri, 22 Nov 2024 15:53:11 -0600 Subject: [PATCH] mock store correctly for Sidebar --- .../ui-src/src/components/report/Sidebar.test.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/services/ui-src/src/components/report/Sidebar.test.tsx b/services/ui-src/src/components/report/Sidebar.test.tsx index 1715e9cf..c4ac64c6 100644 --- a/services/ui-src/src/components/report/Sidebar.test.tsx +++ b/services/ui-src/src/components/report/Sidebar.test.tsx @@ -6,9 +6,9 @@ import { useParams, } from "react-router-dom"; import { Sidebar } from "./Sidebar"; -import { useStore } from "../../utils/state/useStore"; +import { useStore } from "utils"; -jest.mock("../../utils/state/useStore", () => ({ +jest.mock("utils", () => ({ useStore: jest.fn(), })); @@ -38,21 +38,21 @@ const report = { describe("Sidebar", () => { beforeEach(() => { - useStore.mockReturnValue({ + (useStore as unknown as jest.Mock).mockReturnValue({ pageMap: mockPageMap, report, currentPageId: "id-1", setCurrentPageId, }); - useNavigate.mockReturnValue(mockNavigate); - useParams.mockReturnValue({ + (useNavigate as jest.Mock).mockReturnValue(mockNavigate); + (useParams as jest.Mock).mockReturnValue({ reportType: "exampleReport", state: "exampleState", reportId: "123", }); }); test("should not render if missing details from the store", () => { - useStore.mockReturnValueOnce({ + (useStore as unknown as jest.Mock).mockReturnValueOnce({ pageMap: undefined, report: undefined, currentPageId: undefined,