Skip to content

Commit f5ae236

Browse files
committedApr 4, 2018
More tests.
1 parent 72baede commit f5ae236

File tree

6 files changed

+12
-0
lines changed

6 files changed

+12
-0
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
node_modules
22
.idea
3+
coverage

‎jest.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
verbose: false,
3+
collectCoverage: true,
4+
coverageDirectory: './coverage/',
5+
};

‎src/data-structures/priority-queue/__test__/PriorityQueue.test.js

+2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ describe('PriorityQueue', () => {
2626
priorityQueue.add(10, 1);
2727
priorityQueue.add(5, 2);
2828
priorityQueue.add(100, 0);
29+
priorityQueue.add(200, 0);
2930

3031
expect(priorityQueue.poll()).toBe(100);
32+
expect(priorityQueue.poll()).toBe(200);
3133
expect(priorityQueue.poll()).toBe(10);
3234
expect(priorityQueue.poll()).toBe(5);
3335
});

‎src/data-structures/queue/__test__/Queue.test.js

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ describe('Queue', () => {
4646

4747
expect(queue.dequeue()).toBe(1);
4848
expect(queue.dequeue()).toBe(2);
49+
expect(queue.dequeue()).toBeNull();
4950
expect(queue.isEmpty()).toBeTruthy();
5051
});
5152
});

‎src/data-structures/stack/__test__/Stack.test.js

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ describe('Stack', () => {
4646

4747
expect(stack.pop()).toBe(2);
4848
expect(stack.pop()).toBe(1);
49+
expect(stack.pop()).toBeNull();
4950
expect(stack.isEmpty()).toBeTruthy();
5051
});
5152
});

‎src/data-structures/tree/__test__/BinaryTreeNode.test.js

+2
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,7 @@ describe('BinaryTreeNode', () => {
9999

100100
expect(rootNode.replaceChild(rootNode.right, replacementNode)).toBeTruthy();
101101
expect(rootNode.traverseInOrder()).toEqual([1, 2, 5]);
102+
103+
expect(rootNode.replaceChild(new BinaryTreeNode(), new BinaryTreeNode())).toBeFalsy();
102104
});
103105
});

0 commit comments

Comments
 (0)
Please sign in to comment.