Skip to content

Commit 2877788

Browse files
committed
chore: better empty tree handling
1 parent dd02c5c commit 2877788

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Data-Structures/Tree/test/BinarySearchTree.test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ describe('Binary Search Tree', () => {
5959
})
6060

6161
test('should handle empty tree gracefully', () => {
62-
expect(tree.search(22)).toBeNull()
63-
tree.removeValue(22) // Should not throw
62+
const newTree = new Tree()
63+
newTree.removeValue(22) // Should not throw
64+
expect(newTree.search(22)).toBeNull()
6465
})
6566
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy