Skip to content

Commit

Permalink
Add test for non-primitive key
Browse files Browse the repository at this point in the history
Closes #49
  • Loading branch information
sindresorhus committed Dec 2, 2023
1 parent b93ddbd commit a2262c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -756,3 +756,12 @@ test('toString() works as expected', t => {
lru.set('2', 2);
t.is(lru.toString(), '[object [["1",1],["2",2]]]');
});

test('non-primitive key', t => {
const lru = new QuickLRU({maxSize: 99});
const key = ['foo', 'bar'];
const value = true;
lru.set(key, value);
t.true(lru.has(key));
t.is(lru.get(key), value);
});

0 comments on commit a2262c6

Please sign in to comment.