1 | import React from "react";
|
2 |
|
3 | import { grid, gridcell, nextButton } from "@/test/elements";
|
4 | import { render } from "@/test/render";
|
5 | import { user } from "@/test/user";
|
6 |
|
7 | import { StartEndMonths } from "./StartEndMonths";
|
8 |
|
9 | beforeEach(() => {
|
10 | render(<StartEndMonths />);
|
11 | });
|
12 |
|
13 | test("the first month should be January 2024", () => {
|
14 | expect(grid("January 2024")).toBeInTheDocument();
|
15 | expect(gridcell(new Date(2024, 0, 31))).toBeInTheDocument();
|
16 | });
|
17 |
|
18 | describe("when navigating to the last month", () => {
|
19 | beforeEach(async () => {
|
20 |
|
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 | });
|