From 84f0c965bf16bbc7698040bfb8d0cacccd71ea6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Fri, 9 Aug 2024 15:22:16 +0200 Subject: [PATCH] fix(#1703): fix storybook tests --- govtool/frontend/.storybook/preview.tsx | 51 ++++++++++--------- .../GovernanceActionDetailsCard.stories.ts | 6 +-- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/govtool/frontend/.storybook/preview.tsx b/govtool/frontend/.storybook/preview.tsx index 9ee56bf7b..24de697e5 100644 --- a/govtool/frontend/.storybook/preview.tsx +++ b/govtool/frontend/.storybook/preview.tsx @@ -5,6 +5,7 @@ import { I18nextProvider } from "react-i18next"; import { QueryClient, QueryClientProvider } from "react-query"; import { MemoryRouter, Route, Routes } from "react-router-dom"; +import { FeatureFlagProvider } from "../src/context/featureFlag"; import { AppContextProvider } from "../src/context/appContext"; import { ModalProvider } from "../src/context/modal"; import i18n from "../src/i18n"; @@ -26,30 +27,32 @@ const preview: Preview = { (Story) => ( - - - - - - - - - } - /> - - - - - + + + + + + + + + + } + /> + + + + + + ), diff --git a/govtool/frontend/src/stories/GovernanceActionDetailsCard.stories.ts b/govtool/frontend/src/stories/GovernanceActionDetailsCard.stories.ts index 81cbf7366..c84db61a2 100644 --- a/govtool/frontend/src/stories/GovernanceActionDetailsCard.stories.ts +++ b/govtool/frontend/src/stories/GovernanceActionDetailsCard.stories.ts @@ -21,8 +21,8 @@ type Story = StoryObj; const commonArgs = { abstainVotes: 1000000, - createdDate: new Date().toLocaleDateString(), - expiryDate: new Date().toLocaleDateString(), + createdDate: new Date().toISOString(), + expiryDate: new Date().toISOString(), noVotes: 1000000, label: "Info Action", type: GovernanceActionType.InfoAction, @@ -52,7 +52,7 @@ async function assertGovActionDetails( await expect(canvas.getAllByText(todayDate)).toHaveLength(2); await expect( canvas.getByTestId(`${getProposalTypeNoEmptySpaces(args.type)}-type`), - ).toHaveTextContent(args.type); + ).toHaveTextContent(args.label); await expect(canvas.getByTestId(`${args.govActionId}-id`)).toHaveTextContent( args.govActionId, );