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 b1e53b9

Browse files
test(linked-list): more coverage
1 parent 54bb4aa commit b1e53b9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

‎src/data-structures/linked-lists/linked-list.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ describe('LinkedList Test', () => {
116116
linkedList.addLast('found');
117117
});
118118

119+
describe('#length', () => {
120+
it('should have length property', () => {
121+
expect(linkedList.length).toBe(2);
122+
});
123+
});
124+
119125
describe('#indexOf', () => {
120126
it('should find element index', () => {
121127
expect(linkedList.indexOf(0)).toBe(0);
@@ -203,6 +209,20 @@ describe('LinkedList Test', () => {
203209
expect(linkedList.size).toBe(2);
204210
});
205211
});
212+
213+
describe('#removeByPosition', () => {
214+
it('should remove last element', () => {
215+
expect(linkedList.length).toBe(2);
216+
expect(linkedList.removeByPosition(1)).toBe('found');
217+
expect(linkedList.length).toBe(1);
218+
});
219+
220+
it('should remove last element', () => {
221+
expect(linkedList.length).toBe(2);
222+
expect(linkedList.removeByPosition(0)).toBe(0);
223+
expect(linkedList.length).toBe(1);
224+
});
225+
});
206226
});
207227

208228
describe('Doubly Linked List and aliases', () => {

0 commit comments

Comments
(0)

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