-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
48 lines (36 loc) · 1.28 KB
/
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
"use strict";
const { describe, expect, test } = require("@jest/globals");
const ifThursday = require(".");
describe("if-thursday", () => {
test("function is defined", () => {
expect(ifThursday).toBeDefined();
expect(ifThursday).toBeFunction();
});
test("returns boolean", () => {
expect(ifThursday()).toBeBoolean();
});
test("returns True if today is Thursday", () => {
jest.useFakeTimers("modern");
jest.setSystemTime(new Date(2022, 1, 24));
expect(ifThursday()).toBeBoolean();
expect(ifThursday()).toBeTrue();
});
test("returns True if today is the start of Russia's full-scale military invasion of Ukraine", () => {
jest.useFakeTimers("modern");
jest.setSystemTime(new Date(2022, 1, 24));
expect(ifThursday()).toBeBoolean();
expect(ifThursday()).toBeTrue();
});
test("returns False if today isn't Thursday, day before", () => {
jest.useFakeTimers("modern");
jest.setSystemTime(new Date(2022, 1, 23));
expect(ifThursday()).toBeBoolean();
expect(ifThursday()).toBeFalse();
});
test("returns False if today isn't Thursday, day after", () => {
jest.useFakeTimers("modern");
jest.setSystemTime(new Date(2022, 1, 25));
expect(ifThursday()).toBeBoolean();
expect(ifThursday()).toBeFalse();
});
});