-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsolution.spec.js
More file actions
68 lines (66 loc) · 1.52 KB
/
Copy pathsolution.spec.js
File metadata and controls
68 lines (66 loc) · 1.52 KB
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
63
64
65
66
67
68
import { canCarry } from './solution';
describe('Challenge 21: La ruta con los regalos', () => {
describe('canCarry(...)', () => {
const testCases = [
createTestCase(
[
4,
[
[2, 5, 8],
[3, 6, 10]
]
],
false,
'should return false because Santa Claus can not carry all the presents'
),
createTestCase(
[
3,
[
[1, 1, 5],
[2, 2, 10]
]
],
true,
'should return true because Santa Claus can take all the presents'
),
createTestCase(
[
3,
[
[2, 1, 5],
[3, 5, 7]
]
],
true,
'should return true because Santa Claus can take all the presents'
),
createTestCase(
[
4,
[
[2, 3, 8],
[2, 5, 7]
]
],
true,
'should return true because Santa Claus can take all the presents'
),
createTestCase([1, [[2, 3, 8]]], false, 'should return false because Santa Claus can not carry all the presents'),
createTestCase(
[
2,
[
[1, 2, 4],
[2, 3, 8]
]
],
false,
'should return false because Santa Claus can not carry all the presents'
)
];
it.each(testCases)('#$# $description', ({ args, expected }) => {
expect(canCarry(...args)).toEqual(expected);
});
});
});