@@ -101,33 +101,33 @@ describe('retryWithBackoff', () => {
101101 expect ( mockFn ) . toHaveBeenCalledTimes ( 3 ) ;
102102 } ) ;
103103
104- it ( 'should default to 10 maxAttempts if no options are provided' , async ( ) => {
105- // This function will fail more than 10 times to ensure all retries are used.
106- const mockFn = createFailingFunction ( 15 ) ;
104+ it ( 'should default to 3 maxAttempts if no options are provided' , async ( ) => {
105+ // This function will fail more than 3 times to ensure all retries are used.
106+ const mockFn = createFailingFunction ( 5 ) ;
107107
108108 const promise = retryWithBackoff ( mockFn ) ;
109109
110110 await Promise . all ( [
111- expect ( promise ) . rejects . toThrow ( 'Simulated error attempt 10 ' ) ,
111+ expect ( promise ) . rejects . toThrow ( 'Simulated error attempt 3 ' ) ,
112112 vi . runAllTimersAsync ( ) ,
113113 ] ) ;
114114
115- expect ( mockFn ) . toHaveBeenCalledTimes ( 10 ) ;
115+ expect ( mockFn ) . toHaveBeenCalledTimes ( 3 ) ;
116116 } ) ;
117117
118- it ( 'should default to 10 maxAttempts if options.maxAttempts is undefined' , async ( ) => {
119- // This function will fail more than 10 times to ensure all retries are used.
120- const mockFn = createFailingFunction ( 15 ) ;
118+ it ( 'should default to 3 maxAttempts if options.maxAttempts is undefined' , async ( ) => {
119+ // This function will fail more than 3 times to ensure all retries are used.
120+ const mockFn = createFailingFunction ( 5 ) ;
121121
122122 const promise = retryWithBackoff ( mockFn , { maxAttempts : undefined } ) ;
123123
124- // Expect it to fail with the error from the 10th attempt.
124+ // Expect it to fail with the error from the 3rd attempt.
125125 await Promise . all ( [
126- expect ( promise ) . rejects . toThrow ( 'Simulated error attempt 10 ' ) ,
126+ expect ( promise ) . rejects . toThrow ( 'Simulated error attempt 3 ' ) ,
127127 vi . runAllTimersAsync ( ) ,
128128 ] ) ;
129129
130- expect ( mockFn ) . toHaveBeenCalledTimes ( 10 ) ;
130+ expect ( mockFn ) . toHaveBeenCalledTimes ( 3 ) ;
131131 } ) ;
132132
133133 it ( 'should not retry if shouldRetry returns false' , async ( ) => {
0 commit comments