@@ -99,13 +99,14 @@ describe('retryWithBackoff', () => {
9999 expect ( mockFn ) . toHaveBeenCalledTimes ( 3 ) ;
100100 } ) ;
101101
102- it ( 'should default to 5 maxAttempts if no options are provided' , async ( ) => {
103- // This function will fail more than 5 times to ensure all retries are used.
102+ it ( 'should default to 3 maxAttempts if no options are provided' , async ( ) => {
103+ // This function will fail more than 3 times to ensure all retries are used.
104104 const mockFn = createFailingFunction ( 10 ) ;
105105
106106 const promise = retryWithBackoff ( mockFn ) ;
107107
108108 // Expect it to fail with the error from the 5th attempt.
109+ < < < << << HEAD
109110 // eslint-disable-next-line vitest/valid-expect
110111 const assertionPromise = expect ( promise ) . rejects . toThrow (
111112 'Simulated error attempt 5' ,
@@ -118,11 +119,24 @@ describe('retryWithBackoff', () => {
118119
119120 it ( 'should default to 5 maxAttempts if options.maxAttempts is undefined' , async ( ) => {
120121 // This function will fail more than 5 times to ensure all retries are used.
122+ = === ===
123+ await Promise . all ( [
124+ expect ( promise ) . rejects . toThrow ( 'Simulated error attempt 3' ) ,
125+ vi . runAllTimersAsync ( ) ,
126+ ] ) ;
127+
128+ expect ( mockFn ) . toHaveBeenCalledTimes ( 3 ) ;
129+ } ) ;
130+
131+ it ( 'should default to 3 maxAttempts if options.maxAttempts is undefined' , async ( ) => {
132+ // This function will fail more than 3 times to ensure all retries are used.
133+ > >>> >>> dd01af60 ( refactor : set max retry attempts to 3 ( #11072 ) )
121134 const mockFn = createFailingFunction ( 10 ) ;
122135
123136 const promise = retryWithBackoff ( mockFn , { maxAttempts : undefined } ) ;
124137
125138 // Expect it to fail with the error from the 5th attempt.
139+ < < < << << HEAD
126140 // eslint-disable-next-line vitest/valid-expect
127141 const assertionPromise = expect ( promise ) . rejects . toThrow (
128142 'Simulated error attempt 5' ,
@@ -131,6 +145,14 @@ describe('retryWithBackoff', () => {
131145 await assertionPromise ;
132146
133147 expect ( mockFn ) . toHaveBeenCalledTimes ( 5 ) ;
148+ = === ===
149+ await Promise . all ( [
150+ expect ( promise ) . rejects . toThrow ( 'Simulated error attempt 3' ) ,
151+ vi . runAllTimersAsync ( ) ,
152+ ] ) ;
153+
154+ expect ( mockFn ) . toHaveBeenCalledTimes ( 3 ) ;
155+ > >>> >>> dd01af60 ( refactor : set max retry attempts to 3 ( #11072 ) )
134156 } ) ;
135157
136158 it ( 'should not retry if shouldRetry returns false' , async ( ) => {
0 commit comments