Skip to content

Commit

Permalink
Add NotFoundError test for expired entry.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlongley committed Nov 16, 2024
1 parent 77a6b4c commit a303905
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/mocha/10-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,23 @@ describe('Cache', function() {
}
err.message.should.include('Either "id" or "tokenizedId"');
});

it('should return not found for an expired entry', async () => {
const id = crypto.randomUUID();
await cache.upsert({
id,
value: {},
ttl: 0
});

let err;
try {
await cache.get({id});
} catch(e) {
err = e;
}
err.name.should.equal('NotFoundError');
});
});

describe('cache._hmacString()', () => {
Expand Down

0 comments on commit a303905

Please sign in to comment.