Untitled
unknown
plain_text
20 days ago
1.3 kB
3
Indexable
Never
it("should render warnings one after another", async () => { const fakeDate = new Date("2023-04-22"); jest.useFakeTimers("modern"); jest.setSystemTime(fakeDate); // jest.spyOn(global.Date, "now").mockImplementationOnce(() => new Date("2023-04-22").valueOf()); const currentMonth = fakeDate.getUTCMonth(); const currentMonthSelected = defaultState.quarters.map((quarter) => ({ ...quarter, periods: quarter.periods.map((period) => ({ ...period, selected: period.periodStart.getUTCMonth() === currentMonth, })), })); renderComponent({ ...defaultState, formState: { quarters: [], statements }, newRulesInfoShown: true, quarters: currentMonthSelected, }); const button = (await screen.findByText(dictionary.mlhButtonNext)) as HTMLInputElement; userEvent.click(button); expect(await screen.findByText(dictionary.mlhOrangeContractualHeader)).toBeInTheDocument(); const closeBtn = screen.getByLabelText(/Close/); userEvent.click(closeBtn); expect(await screen.findByText(dictionary.mlhOrangeOngoingMonthHeader)).toBeInTheDocument(); });
Leave a Comment