Skip to content

Commit 3acac76

Browse files
Merge pull request #16 from amejiarosario/dev
test(linked-list): more coverage
2 parents 54bb4aa + b1e53b9 commit 3acac76

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

+20
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)