UNPKG

837 BTypeScriptView Raw
1import React from "react";
2
3import { grid, gridcell, nextButton } from "@/test/elements";
4import { render } from "@/test/render";
5import { user } from "@/test/user";
6
7import { StartEndMonths } from "./StartEndMonths";
8
9beforeEach(() => {
10 render(<StartEndMonths />);
11});
12
13test("the first month should be January 2024", () => {
14 expect(grid("January 2024")).toBeInTheDocument();
15 expect(gridcell(new Date(2024, 0, 31))).toBeInTheDocument();
16});
17
18describe("when navigating to the last month", () => {
19 beforeEach(async () => {
20 // click next button 24 times
21 for (let i = 0; i < 24; i++) {
22 await user.click(nextButton());
23 }
24 });
25
26 test("the last month should be December 2025", () => {
27 expect(grid("December 2025")).toBeInTheDocument();
28 expect(gridcell(new Date(2025, 11, 31))).toBeInTheDocument();
29 });
30});