-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsolution.spec.js
44 lines (41 loc) · 1.17 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
40
41
42
43
44
import { getGiftsToRefill } from './solution';
describe('Challenge 07: Doing gifts inventory', () => {
describe('getGiftsToRefill(...)', () => {
const testCases = [
createTestCase([[], [], []], [], 'should return an empty list if no gifts are given'),
createTestCase(
[
['a', 'a'],
['a', 'a'],
['a', 'a']
],
[],
'should return an empty list if all gifts are in all lists'
),
createTestCase(
[
['a', 'a'],
['b', 'b'],
['c', 'c']
],
['a', 'b', 'c'],
'should return all gifts if none of them are at least in two lists (1)'
),
createTestCase(
[
['a', 'b'],
['c', 'd'],
['e', 'f']
],
['a', 'b', 'c', 'd', 'e', 'f'],
'should return all gifts if none of them are at least in two lists (2)'
)
];
it('#T should return an array', () => {
expect(getGiftsToRefill([], [], [])).toBeInstanceOf(Array);
});
it.each(testCases)('#$# $description', ({ args, expected }) => {
expect(getGiftsToRefill(...args)).toEqual(expected);
});
});
});