@@ -595,7 +595,7 @@ describe("paths.mjs exports", () => {
595595 expect ( elapsed ) . toBeLessThan ( 50 )
596596 } )
597597
598- it ( "should handle negative initialDelayMs (treated as ~1ms delay by setTimeout )" , async ( ) => {
598+ it ( "should handle negative initialDelayMs (clamped to 0ms )" , async ( ) => {
599599 let callCount = 0
600600 const start = Date . now ( )
601601 await retryOnTransientError (
@@ -611,7 +611,7 @@ describe("paths.mjs exports", () => {
611611 )
612612 const elapsed = Date . now ( ) - start
613613 expect ( callCount ) . toBe ( 2 )
614- // Negative delay is clamped to ~1ms by setTimeout , should complete quickly
614+ // Negative delay is clamped to 0ms , should complete quickly
615615 expect ( elapsed ) . toBeLessThan ( 50 )
616616 } )
617617
@@ -632,11 +632,10 @@ describe("paths.mjs exports", () => {
632632 expect ( callCount ) . toBe ( 0 ) // Loop never runs
633633 } )
634634
635- it ( "should handle non-numeric initialDelayMs (NaN becomes ~1ms delay )" , async ( ) => {
635+ it ( "should handle non-numeric initialDelayMs (NaN falls back to default 100ms )" , async ( ) => {
636636 let callCount = 0
637637 const start = Date . now ( )
638- // When initialDelayMs is NaN, delay calculation produces NaN
639- // setTimeout with NaN delay treats it as ~1ms
638+ // When initialDelayMs is NaN, it is sanitized to the default 100ms
640639 await retryOnTransientError (
641640 ( ) => {
642641 callCount ++
@@ -650,8 +649,9 @@ describe("paths.mjs exports", () => {
650649 )
651650 const elapsed = Date . now ( ) - start
652651 expect ( callCount ) . toBe ( 2 )
653- // NaN delay becomes ~1ms
654- expect ( elapsed ) . toBeLessThan ( 50 )
652+ // NaN delay falls back to default 100ms
653+ expect ( elapsed ) . toBeGreaterThanOrEqual ( 90 )
654+ expect ( elapsed ) . toBeLessThan ( 200 )
655655 } )
656656
657657 it ( "should handle Infinity retries (up to a reasonable test limit)" , async ( ) => {
0 commit comments