Skip to content

Commit 8d75645

Browse files
committed
test(cache): verify TTLCache behavior for infinite TTL value (Variation 1)
1 parent a231edc commit 8d75645

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/cache.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,20 @@ describe('TTLCache', () => {
473473

474474
cache.destroy();
475475
});
476+
477+
it('verify TTLCache behavior for infinite TTL value (Variation 1)', () => {
478+
const cache = new TTLCache<string>();
479+
480+
expect(() => {
481+
cache.set('infinite-key', 'boundary-value', Infinity);
482+
}).not.toThrow();
483+
484+
expect(cache.get('infinite-key')).toBe('boundary-value');
485+
486+
expect(cache.has('infinite-key')).toBe(true);
487+
488+
cache.destroy();
489+
});
476490
});
477491
});
478492

0 commit comments

Comments
 (0)