UNPKG

575 BTypeScriptView Raw
1import React from "react";
2
3import { render, screen } from "@/test/render";
4
5import { Weeknumber } from "./Weeknumber";
6
7const today = new Date(2021, 10, 25);
8
9beforeAll(() => jest.setSystemTime(today));
10afterAll(() => jest.useRealTimers());
11
12function getWeekButton(week: number) {
13 return screen.getByRole("rowheader", {
14 name: `Week ${week}`
15 });
16}
17
18beforeEach(() => render(<Weeknumber />).container);
19
20describe("when displaying November 2021", () => {
21 test("should display the 45th week number", () => {
22 expect(getWeekButton(45)).toBeInTheDocument();
23 });
24});