-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsolution.spec.js
46 lines (43 loc) · 970 Bytes
/
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
45
46
import { transformTree } from "./solution";
describe("Challenge #16: ❌ Friday deployment", () => {
const testCases = [
createTestCase(
[[3, 1, 0, 8, 12, null, 1]],
{
value: 3,
left: {
value: 1,
left: {
value: 8,
left: null,
right: null,
},
right: {
value: 12,
left: null,
right: null,
},
},
right: {
value: 0,
left: null,
right: {
value: 1,
left: null,
right: null,
},
},
},
"should return the correct tree structure"
),
];
it.each(testCases)(
"#$# $description",
({ input: [tree], expected, description }) => {
expect(transformTree(tree)).toEqual(expected);
}
);
});
function createTestCase(input, expected, description) {
return { input, expected, description };
}