-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchallenge26.spec.js
50 lines (47 loc) · 1.01 KB
/
challenge26.spec.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
const getCompleted = require("./challenge26");
describe("Challenge 26 Tests", () => {
const TEST_CASES = [
{
input: ["01:00:00", "03:00:00"],
output: "33%"
},
{
input: ["02:00:00", "04:00:00"],
output: "50%"
},
{
input: ["01:00:00", "01:00:00"],
output: "100%"
},
{
input: ["00:10:00", "01:00:00"],
output: "17%"
},
{
input: ["01:10:10", "03:30:30"],
output: "33%"
},
{
input: ["03:30:30", "05:50:50"],
output: "60%"
},
{
input: ["00:00:00", "01:00:00"],
output: "0%"
},
{
input: ["00:00:01", "00:00:02"],
output: "50%"
},
{
input: ["23:59:59", "24:00:00"],
output: "100%"
},
];
it("Should return a string", () => {
expect(typeof getCompleted(...TEST_CASES[0].input)).toBe(typeof "");
});
it.each(TEST_CASES)("Should pass the test cases successfully", ({ input, output }) => {
expect(getCompleted(...input)).toEqual(output);
});
});