From 8f9a9130a5d6669418595519513115df1105d444 Mon Sep 17 00:00:00 2001 From: Bart K Date: Thu, 21 Nov 2024 10:40:54 +0100 Subject: [PATCH] fix(portal): add history list tests --- .../PushHistoryList/index.test.tsx | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 kraken-app/kraken-app-portal/src/__test__/pages/EnvironmentActivityLog/PushHistoryList/index.test.tsx diff --git a/kraken-app/kraken-app-portal/src/__test__/pages/EnvironmentActivityLog/PushHistoryList/index.test.tsx b/kraken-app/kraken-app-portal/src/__test__/pages/EnvironmentActivityLog/PushHistoryList/index.test.tsx new file mode 100644 index 00000000..497d66d9 --- /dev/null +++ b/kraken-app/kraken-app-portal/src/__test__/pages/EnvironmentActivityLog/PushHistoryList/index.test.tsx @@ -0,0 +1,38 @@ +import { render } from "@testing-library/react"; +import { QueryClientProvider } from "@tanstack/react-query"; +import { queryClient } from "@/utils/helpers/reactQuery"; +import { BrowserRouter } from "react-router-dom"; +import * as pushHistoryHook from '@/hooks/pushApiEvent' +import PushHistoryList from '@/pages/EnvironmentActivityLog/components/PushHistoryList'; + +test("PushHistoryList", () => { + vi.spyOn(pushHistoryHook, "useGetPushActivityLogHistory").mockReturnValue({ + data: { + data: [ + { + id: "9c36802a-0118-40a3-8546-b880dc6f7d15", + createdAt: "2024-11-20T08:40:38.480088Z", + envName: "stage", + startTime: "2024-10-09T23:00:00Z", + endTime: "2024-10-11T22:59:59Z", + pushedBy: "fc5f6165-aa20-4798-a9ee-78afbe3cf06d", + status: "DONE" + }], + total: 1, + size: 10, + page: 0, + }, + isLoading: false, + isFetching: false, + isFetched: true, + } as any) + + const { container } = render( + + + + + + ); + expect(container).toBeInTheDocument(); +});