-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsolution.spec.js
39 lines (36 loc) · 1.02 KB
/
solution.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
import { maxDistance } from "./solution";
describe("Challenge #6: 🦌 The reindeer on trial", () => {
const testCases = [
createTestCase(
[">>*<<"],
4,
"should return the maximum distance traveled for mixed movements"
),
createTestCase(
["<<>>"],
2,
"should return the maximum distance traveled for left and right movements"
),
createTestCase(
[">***>"],
5,
"should return the maximum distance traveled for mixed movements with wildcard"
),
createTestCase(
["<>*<"],
3,
"should return the maximum distance traveled for mixed movements with wildcard"
),
createTestCase(
["*"],
1,
"should return the maximum distance traveled for a single wildcard movement"
),
];
it.each(testCases)("#$# $description", ({ input, expected, description }) => {
expect(maxDistance(...input)).toEqual(expected);
});
});
function createTestCase(input, expected, description) {
return { input, expected, description };
}