-
Notifications
You must be signed in to change notification settings - Fork 750
/
Copy pathlocaleWeek.test.js
54 lines (43 loc) · 1.98 KB
/
localeWeek.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* global test expect */
import { Info } from "../../src/luxon";
const Helpers = require("../helpers");
test("Info.getStartOfWeek reports the correct start of the week", () => {
expect(Info.getStartOfWeek({ locale: "en-US" })).toBe(7);
expect(Info.getStartOfWeek({ locale: "de-DE" })).toBe(1);
});
Helpers.withoutLocaleWeekInfo("Info.getStartOfWeek reports Monday as the start of the week", () => {
expect(Info.getStartOfWeek({ locale: "en-US" })).toBe(1);
expect(Info.getStartOfWeek({ locale: "de-DE" })).toBe(1);
});
test("Info.getMinimumDaysInFirstWeek reports the correct value", () => {
expect(Info.getMinimumDaysInFirstWeek({ locale: "en-US" })).toBe(1);
expect(Info.getMinimumDaysInFirstWeek({ locale: "de-DE" })).toBe(4);
});
Helpers.withoutLocaleWeekInfo("Info.getMinimumDaysInFirstWeek reports 4", () => {
expect(Info.getMinimumDaysInFirstWeek({ locale: "en-US" })).toBe(4);
expect(Info.getMinimumDaysInFirstWeek({ locale: "de-DE" })).toBe(4);
});
test("Info.getWeekendWeekdays reports the correct value", () => {
expect(Info.getWeekendWeekdays({ locale: "en-US" })).toStrictEqual([6, 7]);
expect(Info.getWeekendWeekdays({ locale: "he" })).toStrictEqual([5, 6]);
});
Helpers.withoutLocaleWeekInfo("Info.getWeekendWeekdays reports [6, 7]", () => {
expect(Info.getWeekendWeekdays({ locale: "en-US" })).toStrictEqual([6, 7]);
expect(Info.getWeekendWeekdays({ locale: "he" })).toStrictEqual([6, 7]);
});
test("Info.getStartOfWeek honors the default locale", () => {
Helpers.withDefaultLocale("en-US", () => {
expect(Info.getStartOfWeek()).toBe(7);
expect(Info.getMinimumDaysInFirstWeek()).toBe(1);
expect(Info.getWeekendWeekdays()).toStrictEqual([6, 7]);
});
Helpers.withDefaultLocale("de-DE", () => {
expect(Info.getStartOfWeek()).toBe(1);
});
Helpers.withDefaultLocale("he", () => {
expect(Info.getWeekendWeekdays()).toStrictEqual([5, 6]);
});
Helpers.withDefaultLocale("he", () => {
expect(Info.getWeekendWeekdays()).toStrictEqual([5, 6]);
});
});