Skip to content

Commit

Permalink
Updating test to validate there is only 1 null next & previous wi…
Browse files Browse the repository at this point in the history
…thin cache items
  • Loading branch information
avoidwork committed Nov 30, 2018
1 parent 4f2fae5 commit cd1d926
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/lru.js
Expand Up @@ -102,7 +102,7 @@ exports.suite = {

cache.max = 2e4;
cache.expiry = 25;
test.expect(4);
test.expect(5);
test.equal(cache.length, 0, "Should be '0'");
populate(cache);
test.equal(cache.length, cache.max, `Should be '${cache.max}'`);
Expand All @@ -112,7 +112,8 @@ exports.suite = {
cache.remove(20006);
setTimeout(() => {
cache.remove(20007);
test.equal(Object.keys(cache.cache).map(i => cache.cache[i]).filter(i => i.next === i.previous).length, 0, "Should be '0'");
test.equal(Object.keys(cache.cache).map(i => cache.cache[i]).filter(i => i.next === null).length, 1, "Should be '1'");
test.equal(Object.keys(cache.cache).map(i => cache.cache[i]).filter(i => i.previous === null).length, 1, "Should be '1'");
test.done();
}, 25);
}
Expand Down

0 comments on commit cd1d926

Please sign in to comment.