Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2877788

Browse files
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)

AltStyle によって変換されたページ (->オリジナル) /