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 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‎

Lines changed: 24 additions & 0 deletions
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)

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