-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchallenge13.spec.js
62 lines (59 loc) · 1021 Bytes
/
challenge13.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
51
52
53
54
55
56
57
58
59
60
61
62
const isRobotBack = require("./challenge13");
describe("Challenge 13 Tests", () => {
const TEST_CASES = [
{
input: "R",
output: [1, 0]
},
{
input: "RL",
output: true
},
{
input: "RLUD",
output: true
},
{
input: "*RU",
output: [2, 1]
},
{
input: "R*U",
output: [1, 2]
},
{
input: "LLL!R",
output: [-4, 0]
},
{
input: "R?R",
output: [1, 0]
},
{
input: "U?D",
output: true
},
{
input: "R!L",
output: [2, 0]
},
{
input: "U!D",
output: [0, 2]
},
{
input: "R?L",
output: true
},
{
input: "U?U",
output: [0, 1]
},
];
it("Should return a boolean", () => {
expect(typeof isRobotBack(TEST_CASES[1].input)).toBe(typeof true);
});
it.each(TEST_CASES)("Should pass the test cases successfully", ({ input, output }) => {
expect(isRobotBack(input)).toEqual(output);
});
});