UNPKG

1 kBPlain TextView Raw
1import { es } from "date-fns/locale/es";
2
3import type { Modifiers } from "../types";
4
5import { labelDayButton } from "./labelDayButton";
6
7const day = new Date(2022, 10, 21);
8const dayModifiers: Modifiers = {
9 disabled: false,
10 focusable: false,
11 focused: false,
12 hidden: false,
13 outside: false,
14 range_end: false,
15 range_middle: false,
16 range_start: false,
17 selected: false,
18 today: false
19};
20
21describe("when the day is selected", () => {
22 test("return the label", () => {
23 expect(labelDayButton(day, { ...dayModifiers, selected: true })).toEqual(
24 "Monday, November 21st, 2022, selected"
25 );
26 });
27});
28
29describe("when the day is today", () => {
30 test("return the label", () => {
31 expect(labelDayButton(day, { ...dayModifiers, today: true })).toEqual(
32 "Today, Monday, November 21st, 2022"
33 );
34 });
35});
36
37test("should return the localized label", () => {
38 expect(labelDayButton(day, dayModifiers, { locale: es })).toEqual(
39 "lunes, 21 de noviembre de 2022"
40 );
41});