diff --git a/src/data-structures/linked-lists/linked-list.spec.js b/src/data-structures/linked-lists/linked-list.spec.js index 46a04075..288412c1 100644 --- a/src/data-structures/linked-lists/linked-list.spec.js +++ b/src/data-structures/linked-lists/linked-list.spec.js @@ -116,6 +116,12 @@ describe('LinkedList Test', () => { linkedList.addLast('found'); }); + describe('#length', () => { + it('should have length property', () => { + expect(linkedList.length).toBe(2); + }); + }); + describe('#indexOf', () => { it('should find element index', () => { expect(linkedList.indexOf(0)).toBe(0); @@ -203,6 +209,20 @@ describe('LinkedList Test', () => { expect(linkedList.size).toBe(2); }); }); + + describe('#removeByPosition', () => { + it('should remove last element', () => { + expect(linkedList.length).toBe(2); + expect(linkedList.removeByPosition(1)).toBe('found'); + expect(linkedList.length).toBe(1); + }); + + it('should remove last element', () => { + expect(linkedList.length).toBe(2); + expect(linkedList.removeByPosition(0)).toBe(0); + expect(linkedList.length).toBe(1); + }); + }); }); describe('Doubly Linked List and aliases', () => {