-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsolution.spec.js
27 lines (23 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
import { checkIsSameTree } from './solution';
describe('Challenge 24: Comparando árboles de Navidad', () => {
describe('checkIsSameTree(...)', () => {
const treeOne = {
value: 1,
left: { value: 2, left: null, right: null },
right: { value: 3, left: null, right: null }
};
const treeTwo = {
value: 1,
left: { value: 3, left: { value: 2, left: null, right: null }, right: null },
right: { value: 5, left: null, right: { value: 4, left: null, right: null } }
};
const testCases = [
createTestCase([treeOne, treeOne], true, 'should return true because treeOne is being compared with itself'),
createTestCase([treeOne, treeTwo], false, 'should return false because treeOne is being compared with treeTwo'),
createTestCase([treeTwo, treeTwo], true, 'should return true because treeTwo is being compared with itself')
];
it.each(testCases)('#$# $description', ({ args, expected }) => {
expect(checkIsSameTree(...args)).toEqual(expected);
});
});
});