Skip to content

Commit

Permalink
added a test case
Browse files Browse the repository at this point in the history
  • Loading branch information
mike442144 committed Jun 8, 2018
1 parent 80b89ec commit f803a4d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/LinkedList.js
Expand Up @@ -182,4 +182,22 @@ describe("Linked List", function(){
ll.insertStartNode(n).should.be.equal(ll);
});
});

it('should return itself to support calling chain when insertStart[Node]()/insertEnd[Node]() is called', function(){
var total = 1000;
for(var i=0;i<total;i++){
var step = Math.floor(Math.random() * 100);
for(var j=0;j<step;j++){
ll.insertStart(1);
}
step = Math.floor(Math.random() * 5);
for(j=0;j<step;j++){
ll.deleteFirst();
}
}

while(ll.length){
ll.deleteFirst();
}
});
});

0 comments on commit f803a4d

Please sign in to comment.