File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -363,6 +363,13 @@ describe('TTLCache', () => {
363363 } ) ;
364364
365365 describe ( 'edge cases and error handling' , ( ) => {
366+ // FIX: New test explicitly targeting the -5000 boundary for Issue #1398
367+ it ( 'throws RangeError when setting a value with -5000 TTL' , ( ) => {
368+ const cache = new TTLCache < string > ( ) ;
369+ expect ( ( ) => cache . set ( 'key' , 'value' , - 5000 ) ) . toThrow ( RangeError ) ;
370+ cache . destroy ( ) ;
371+ } ) ;
372+
366373 it ( 'throws RangeError when ttlMs is 0 or negative' , ( ) => {
367374 const cache = new TTLCache < string > ( ) ;
368375 expect ( ( ) => cache . set ( 'key' , 'value' , 0 ) ) . toThrow ( RangeError ) ;
@@ -401,6 +408,7 @@ describe('TTLCache', () => {
401408 expect ( [ null , 'lived' ] ) . toContain ( result ) ;
402409 cache . destroy ( ) ;
403410 } ) ;
411+
404412 it ( 'does not throw when ttlMs is Number.EPSILON' , ( ) => {
405413 const cache = new TTLCache < string > ( ) ;
406414
You can’t perform that action at this time.
0 commit comments