From 30be745a1caa4b0718224ff1ca70449148daab65 Mon Sep 17 00:00:00 2001 From: Mats Eriksson Date: Mon, 16 Sep 2024 12:27:25 +0300 Subject: [PATCH] remove: tests for ReservationStatus --- .../__tests__/ReservationStatus.test.tsx | 69 ------------------- 1 file changed, 69 deletions(-) delete mode 100644 apps/ui/components/reservation/__tests__/ReservationStatus.test.tsx diff --git a/apps/ui/components/reservation/__tests__/ReservationStatus.test.tsx b/apps/ui/components/reservation/__tests__/ReservationStatus.test.tsx deleted file mode 100644 index 645d62d09e..0000000000 --- a/apps/ui/components/reservation/__tests__/ReservationStatus.test.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import * as React from "react"; -import { get as mockGet } from "lodash"; -import { ReservationStateChoice } from "@gql/gql-types"; -import { render, screen } from "../../../test/testUtils"; -import { ReservationStatus, type Props } from "../ReservationStatus"; -import mockTranslations from "../../../public/locales/fi/reservations.json"; - -// TODO use a proper mocking solution in setup -jest.mock("next-i18next", () => ({ - useTranslation: () => { - return { - t: (str: string, params?: Record) => { - const path = str.replace("reservations:", ""); - const key = - // @ts-expect-error -- TODO replace with mocks - mockGet(mockTranslations, `${path}_other`) && params?.count > 1 - ? `${path}_other` - : path; - return mockGet(mockTranslations, key)?.replace( - /{{(.*?)}}/g, - // @ts-expect-error -- TODO replace with mocks - (val, paramKey) => (params[paramKey] ? params[paramKey] : val) - ); - }, - }; - }, -})); - -const defaultProps: Props = { - state: "" as ReservationStateChoice, -}; - -const renderComponent = (props?: Partial) => - render(); - -[ - { - status: ReservationStateChoice.Cancelled, - label: "Peruttu", - }, - { - status: ReservationStateChoice.Confirmed, - label: "Hyväksytty", - }, - { - status: ReservationStateChoice.Denied, - label: "Hylätty", - }, - { - status: ReservationStateChoice.Created, - label: "Luonnos", - }, - { - status: ReservationStateChoice.RequiresHandling, - label: "Käsiteltävänä", - }, - { - status: ReservationStateChoice.WaitingForPayment, - label: "Odottaa maksua", - }, -].forEach((state) => { - test(`should render ${state.status}`, () => { - renderComponent({ - state: state.status, - }); - - expect(screen.getByText(state.label)).toHaveAttribute("title", state.label); - }); -});