Skip to content

Commit

Permalink
test for pop()
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Feb 8, 2022
1 parent 385bf73 commit 7c94cb6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/pop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const t = require('tap')
const LRU = require('../')
const cache = new LRU({ max: 5 })
for (let i = 0; i < 5; i++) {
cache.set(i, i)
}
cache.get(2)
const popped = []
let p
do {
p = cache.pop()
popped.push(p)
} while (p !== undefined)
t.same(popped, [0, 1, 3, 4, 2, undefined])

0 comments on commit 7c94cb6

Please sign in to comment.