Skip to content

Commit 29b1650

Browse files
christian-feiTheSTL
authored andcommitted
add test for bottom view binary tree (knaxus#147)
* add test for bottom view binary tree
1 parent 9793691 commit 29b1650

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const BinaryTree = require("../index");
2+
const bottomView = require('.');
3+
4+
describe('Bottom View Binary Tree', () => {
5+
let btree
6+
7+
beforeEach(() => {
8+
btree = new BinaryTree([1, 2, 3, 4, 5, 6]);
9+
});
10+
11+
it('Should determine the bottom view of a binary tree', () => {
12+
expect(bottomView(btree)).toEqual([6, 2, 3, 4]);
13+
});
14+
it('Should handle null binary tree', () => {
15+
expect(bottomView(null)).toEqual([]);
16+
});
17+
});

0 commit comments

Comments
 (0)