Skip to content

Commit 07336e0

Browse files
authored
test(cache): verify TTLCache behavior for infinite TTL value (Variation 1) (JhaSourav07#1603)
## Description Fixes JhaSourav07#1390 ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [x] 🛠️ Other (Bug fix, refactoring, docs, testing) ## Visual Preview No visual UI updates (Pure edge-case boundary unit test coverage addition for the `TTLCache` utility). ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally. - [x] I have run the isolated file prettier formatter. - [x] My commits follow the Conventional Commits format (`test(cache): ...`). - [x] I have made sure that I have only one clean commit to merge in this PR.
2 parents b124f6b + 8d75645 commit 07336e0

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)