We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 41fef14 + c601e25 commit 2fd85e2Copy full SHA for 2fd85e2
src/_DataStructures_/Trees/BinarySearchTree/BinarySearchTree.test.js
@@ -0,0 +1,25 @@
1
+const BST = require('.');
2
+
3
+describe('Data Structure : Binary Search Tree', () => {
4
+ it('Should be class', () => {
5
+ expect(typeof BST.prototype.constructor).toEqual('function');
6
+ });
7
8
+ describe('Binary Search Tree API', () => {
9
+ let bst = null;
10
11
+ beforeEach(() => {
12
+ bst = new BST(5);
13
14
15
+ it('Should delete() an element from Binary Search Tree', () => {
16
+ bst.add(4);
17
+ bst.add(9);
18
+ bst.add(2);
19
+ bst.delete(bst.root, 4);
20
+ expect(bst.traverseInorder()).toEqual([2, 5, 9]);
21
+ bst.delete(bst.root, 2);
22
+ expect(bst.traverseInorder()).toEqual([5, 9]);
23
24
25
+});
0 commit comments