@@ -96,34 +96,34 @@ describe('retryWithBackoff', () => {
9696 expect ( mockFn ) . toHaveBeenCalledTimes ( 3 ) ;
9797 } ) ;
9898
99- it ( 'should default to 5 maxAttempts if no options are provided' , async ( ) => {
100- // This function will fail more than 5 times to ensure all retries are used.
99+ it ( 'should default to 3 maxAttempts if no options are provided' , async ( ) => {
100+ // This function will fail more than 3 times to ensure all retries are used.
101101 const mockFn = createFailingFunction ( 10 ) ;
102102
103103 const promise = retryWithBackoff ( mockFn ) ;
104104
105105 // Expect it to fail with the error from the 5th attempt.
106106 await Promise . all ( [
107- expect ( promise ) . rejects . toThrow ( 'Simulated error attempt 10 ' ) ,
107+ expect ( promise ) . rejects . toThrow ( 'Simulated error attempt 3 ' ) ,
108108 vi . runAllTimersAsync ( ) ,
109109 ] ) ;
110110
111- expect ( mockFn ) . toHaveBeenCalledTimes ( 10 ) ;
111+ expect ( mockFn ) . toHaveBeenCalledTimes ( 3 ) ;
112112 } ) ;
113113
114- it ( 'should default to 10 maxAttempts if options.maxAttempts is undefined' , async ( ) => {
115- // This function will fail more than 5 times to ensure all retries are used.
114+ it ( 'should default to 3 maxAttempts if options.maxAttempts is undefined' , async ( ) => {
115+ // This function will fail more than 3 times to ensure all retries are used.
116116 const mockFn = createFailingFunction ( 10 ) ;
117117
118118 const promise = retryWithBackoff ( mockFn , { maxAttempts : undefined } ) ;
119119
120120 // Expect it to fail with the error from the 5th attempt.
121121 await Promise . all ( [
122- expect ( promise ) . rejects . toThrow ( 'Simulated error attempt 10 ' ) ,
122+ expect ( promise ) . rejects . toThrow ( 'Simulated error attempt 3 ' ) ,
123123 vi . runAllTimersAsync ( ) ,
124124 ] ) ;
125125
126- expect ( mockFn ) . toHaveBeenCalledTimes ( 10 ) ;
126+ expect ( mockFn ) . toHaveBeenCalledTimes ( 3 ) ;
127127 } ) ;
128128
129129 it ( 'should not retry if shouldRetry returns false' , async ( ) => {
0 commit comments