Skip to content

Commit

Permalink
test(linked-list): more coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
amejiarosario committed May 27, 2019
1 parent 54bb4aa commit b1e53b9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/data-structures/linked-lists/linked-list.spec.js
Expand Up @@ -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);
Expand Down Expand Up @@ -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', () => {
Expand Down

0 comments on commit b1e53b9

Please sign in to comment.