Skip to content

Commit 13eadd2

Browse files
committed
Refactoring in the RBT tests
1 parent 79b865e commit 13eadd2

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

test/data-structures/red-black-tree.spec.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,21 @@ describe('RBTree', function () {
8080
});
8181

8282
describe('get method', function () {
83-
var tree = new RBTree();
84-
expect(tree.get(1)).toBeUndefined();
85-
tree.put(1, 'baz');
86-
expect(tree.get(1)).toBe('baz');
87-
tree.put(2, 'foo');
88-
expect(tree.get(2)).toBe('foo');
89-
tree.put(3, 'bar');
90-
expect(tree.get(3)).toBe('bar');
91-
expect(tree.get(4)).toBeUndefined();
92-
tree.put(5, 'foobar');
93-
expect(tree.get(5)).toBe('foobar');
94-
tree.put(5, 'foobar1');
95-
expect(tree.get(5)).toBe('foobar1');
83+
it('should be able to find value by given key', function () {
84+
var tree = new RBTree();
85+
expect(tree.get(1)).toBeUndefined();
86+
tree.put(1, 'baz');
87+
expect(tree.get(1)).toBe('baz');
88+
tree.put(2, 'foo');
89+
expect(tree.get(2)).toBe('foo');
90+
tree.put(3, 'bar');
91+
expect(tree.get(3)).toBe('bar');
92+
expect(tree.get(4)).toBeUndefined();
93+
tree.put(5, 'foobar');
94+
expect(tree.get(5)).toBe('foobar');
95+
tree.put(5, 'foobar1');
96+
expect(tree.get(5)).toBe('foobar1');
97+
});
9698
});
9799

98100
});

0 commit comments

Comments
 (0)