-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchallenge08.spec.js
45 lines (42 loc) · 1.09 KB
/
challenge08.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
const drawRace = require("./challenge08");
describe("Challenge 08 Tests", () => {
const TEST_CASES = [
{
input: [[0, 5, -3], 10],
output: " ~~~~~~~~~~ /1\n" +
" ~~~~~r~~~~ /2\n" +
"~~~~~~~r~~ /3"
},
{
input: [[2, -1, 0, 5], 8],
output: " ~~r~~~~~ /1\n" +
" ~~~~~~~r /2\n" +
" ~~~~~~~~ /3\n" +
"~~~~~r~~ /4"
},
{
input: [[3, 7, -2], 12],
output: " ~~~r~~~~~~~~ /1\n" +
" ~~~~~~~r~~~~ /2\n" +
"~~~~~~~~~~r~ /3"
},
{
input: [[0, 0, 0], 6],
output: " ~~~~~~ /1\n" +
" ~~~~~~ /2\n" +
"~~~~~~ /3"
},
{
input: [[5, 3, -4], 9],
output: " ~~~~~r~~~ /1\n" +
" ~~~r~~~~~ /2\n" +
"~~~~~r~~~ /3"
},
];
it("Should return a string", () => {
expect(typeof drawRace(...TEST_CASES[0].input)).toBe(typeof "");
});
it.each(TEST_CASES)("Should pass the test cases successfully", ({ input, output }) => {
expect(drawRace(...input)).toEqual(output);
});
});