Skip to content

Commit 09e7441

Browse files
committed
--fix : code coverage near 100%
1 parent c8af420 commit 09e7441

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/_DataStructures_/Queue/Queue.test.js

+24
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,30 @@ describe('Data Structure : Queue', () => {
5353
expect(queue.dequeue()).toEqual(1);
5454
expect(queue.dequeue()).toEqual(4);
5555
expect(queue.dequeue()).toEqual(3);
56+
expect(queue.dequeue()).toEqual(null);
57+
});
58+
59+
it('Length of linkedlist', () => {
60+
const queue2 = new Queue();
61+
queue2.enqueue(2);
62+
queue2.enqueue(1);
63+
queue2.enqueue(4);
64+
queue2.enqueue(3);
65+
expect(queue2.length()).toEqual(4);
66+
});
67+
68+
it('Destroy linkedList', () => {
69+
queue.destroy();
70+
expect(queue.length()).toEqual(0);
71+
});
72+
73+
it('Override and throw error for other LL methods', () => {
74+
expect(() => { queue.addAtBeginning(); }).toThrowError('Not Allowed');
75+
expect(() => { queue.addAt(); }).toThrowError('Not Allowed');
76+
expect(() => { queue.removeFromEnd(); }).toThrowError('Not Allowed');
77+
expect(() => { queue.getLast(); }).toThrowError('Not Allowed');
78+
expect(() => { queue.getAt(); }).toThrowError('Not Allowed');
79+
expect(() => { queue.removeAt(); }).toThrowError('Not Allowed');
5680
});
5781
});
5882
});

0 commit comments

Comments
 (0)