Untitled
unknown
plain_text
a year ago
1.3 kB
10
Indexable
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();
});Editor is loading...
Leave a Comment