@@ -56,12 +56,12 @@ beforeEach(() => {
56
56
jest . useRealTimers ( )
57
57
} )
58
58
59
- test ( 'test exponential backoff with success in first attempt without mock retryOn' , async ( ) => {
59
+ test ( 'exponential backoff with success in first attempt without mock retryOn' , async ( ) => {
60
60
const result = await fetchClient . exponentialBackoff ( 'https://abc.com/' , { method : 'GET' } )
61
61
expect ( result . status ) . toBe ( 200 )
62
62
} )
63
63
64
- test ( 'test exponentialBackoff with no retries on 4xx errors without mock retryOn' , async ( ) => {
64
+ test ( 'exponentialBackoff with no retries on 4xx errors without mock retryOn' , async ( ) => {
65
65
const retrySpy = jest . spyOn ( fetchClient , '__getRetryOn' )
66
66
fetchMock . mockResponse ( '404 Not Found' , {
67
67
status : 404
@@ -72,7 +72,7 @@ test('test exponentialBackoff with no retries on 4xx errors without mock retryOn
72
72
retrySpy . mockRestore ( )
73
73
} )
74
74
75
- test ( 'test exponentialBackoff with 3 retries on 5xx errors without mock retryOn' , async ( ) => {
75
+ test ( 'exponentialBackoff with 3 retries on 5xx errors without mock retryOn' , async ( ) => {
76
76
const retrySpy = jest . spyOn ( fetchClient , '__getRetryOn' )
77
77
fetchMock . mockResponse ( '500 Internal Server Error' , {
78
78
status : 500
@@ -83,7 +83,7 @@ test('test exponentialBackoff with 3 retries on 5xx errors without mock retryOn'
83
83
retrySpy . mockRestore ( )
84
84
} )
85
85
86
- test ( 'test exponential backoff with success in first attempt' , async ( ) => {
86
+ test ( 'exponential backoff with success in first attempt' , async ( ) => {
87
87
const mockDefaultFn = __testRetryOnHelper ( 3 )
88
88
const retrySpy = jest . spyOn ( fetchClient , '__getRetryOn' ) . mockImplementation ( ( retries ) => {
89
89
return mockDefaultFn
@@ -98,7 +98,7 @@ test('test exponential backoff with success in first attempt', async () => {
98
98
retrySpy . mockRestore ( )
99
99
} )
100
100
101
- test ( 'test exponentialBackoff with no retries on 4xx errors and default retry strategy' , async ( ) => {
101
+ test ( 'exponentialBackoff with no retries on 4xx errors and default retry strategy' , async ( ) => {
102
102
const mockDefaultFn = __testRetryOnHelper ( 3 )
103
103
const retrySpy = jest . spyOn ( fetchClient , '__getRetryOn' ) . mockImplementation ( ( retries ) => {
104
104
return mockDefaultFn
@@ -113,7 +113,7 @@ test('test exponentialBackoff with no retries on 4xx errors and default retry st
113
113
retrySpy . mockRestore ( )
114
114
} )
115
115
116
- test ( 'test exponentialBackoff with 3 retries on 429 errors and default retry strategy' , async ( ) => {
116
+ test ( 'exponentialBackoff with 3 retries on 429 errors and default retry strategy' , async ( ) => {
117
117
const mockDefaultFn = __testRetryOnHelper ( 3 )
118
118
const retrySpy = jest . spyOn ( fetchClient , '__getRetryOn' ) . mockImplementation ( ( retries ) => mockDefaultFn )
119
119
fetchMock . mockResponse ( '429 Too many requests' , {
@@ -126,7 +126,7 @@ test('test exponentialBackoff with 3 retries on 429 errors and default retry str
126
126
retrySpy . mockRestore ( )
127
127
} )
128
128
129
- test ( 'test exponentialBackoff with 3 retries on 5xx errors and default retry strategy' , async ( ) => {
129
+ test ( 'exponentialBackoff with 3 retries on 5xx errors and default retry strategy' , async ( ) => {
130
130
const mockDefaultFn = __testRetryOnHelper ( 3 )
131
131
const retrySpy = jest . spyOn ( fetchClient , '__getRetryOn' ) . mockImplementation ( ( retries ) => {
132
132
return mockDefaultFn
@@ -141,7 +141,7 @@ test('test exponentialBackoff with 3 retries on 5xx errors and default retry str
141
141
retrySpy . mockRestore ( )
142
142
} )
143
143
144
- test ( 'test exponentialBackoff with 3 retries on errors with default retry strategy and date in Retry-After header' , async ( ) => {
144
+ test ( 'exponentialBackoff with 3 retries on errors with default retry strategy and date in Retry-After header' , async ( ) => {
145
145
const spy = jest . spyOn ( global . Date , 'now' ) . mockImplementation ( ( ) => new Date ( 'Mon, 13 Feb 2023 23:59:59 GMT' ) )
146
146
const header = 'Tue, 14 Feb 2023 00:00:00 GMT'
147
147
fetchMock . mockResponse ( '503 Service Unavailable' , {
@@ -155,7 +155,7 @@ test('test exponentialBackoff with 3 retries on errors with default retry strate
155
155
expect ( spy ) . toHaveBeenCalledTimes ( 2 )
156
156
} )
157
157
158
- test ( 'test exponential backoff with success in first attempt and custom retryOptions' , async ( ) => {
158
+ test ( 'exponential backoff with success in first attempt and custom retryOptions' , async ( ) => {
159
159
const mockDefaultFn = __testRetryOnHelper ( 2 )
160
160
const retrySpy = jest . spyOn ( fetchClient , '__getRetryOn' ) . mockImplementation ( ( retries ) => {
161
161
return mockDefaultFn
@@ -170,7 +170,7 @@ test('test exponential backoff with success in first attempt and custom retryOpt
170
170
retrySpy . mockRestore ( )
171
171
} )
172
172
173
- test ( 'test exponentialBackoff with no retries on 4xx errors and custom retryOptions' , async ( ) => {
173
+ test ( 'exponentialBackoff with no retries on 4xx errors and custom retryOptions' , async ( ) => {
174
174
const mockDefaultFn = __testRetryOnHelper ( 1 )
175
175
const retrySpy = jest . spyOn ( fetchClient , '__getRetryOn' ) . mockImplementation ( ( retries ) => {
176
176
return mockDefaultFn
@@ -185,7 +185,7 @@ test('test exponentialBackoff with no retries on 4xx errors and custom retryOpti
185
185
retrySpy . mockRestore ( )
186
186
} )
187
187
188
- test ( 'test exponentialBackoff with 3 retries on 5xx errors and custom retryOptions' , async ( ) => {
188
+ test ( 'exponentialBackoff with 3 retries on 5xx errors and custom retryOptions' , async ( ) => {
189
189
const mockDefaultFn = __testRetryOnHelper ( 2 )
190
190
const retrySpy = jest . spyOn ( fetchClient , '__getRetryOn' ) . mockImplementation ( ( retries ) => {
191
191
return mockDefaultFn
@@ -200,7 +200,7 @@ test('test exponentialBackoff with 3 retries on 5xx errors and custom retryOptio
200
200
retrySpy . mockRestore ( )
201
201
} )
202
202
203
- test ( 'test exponential backoff with success in first attempt and custom retryOn' , async ( ) => {
203
+ test ( 'exponential backoff with success in first attempt and custom retryOn' , async ( ) => {
204
204
const mockDefaultFn = __testRetryOnHelper ( 2 , 399 , 500 )
205
205
fetchMock . mockResponse ( '200 OK' , {
206
206
status : 200
@@ -210,7 +210,7 @@ test('test exponential backoff with success in first attempt and custom retryOn'
210
210
expect ( mockDefaultFn ) . toHaveBeenCalledTimes ( 1 )
211
211
} )
212
212
213
- test ( 'test exponentialBackoff with no retries on 4xx errors and custom retryOn' , async ( ) => {
213
+ test ( 'exponentialBackoff with no retries on 4xx errors and custom retryOn' , async ( ) => {
214
214
const mockDefaultFn = __testRetryOnHelper ( 2 , 399 , 500 )
215
215
fetchMock . mockResponse ( '404 Not Found' , {
216
216
status : 404
@@ -221,7 +221,7 @@ test('test exponentialBackoff with no retries on 4xx errors and custom retryOn',
221
221
expect ( mockDefaultFn ) . toHaveBeenCalledTimes ( 3 )
222
222
} )
223
223
224
- test ( 'test exponentialBackoff with 3 retries on 5xx errors and custom retryOn' , async ( ) => {
224
+ test ( 'exponentialBackoff with 3 retries on 5xx errors and custom retryOn' , async ( ) => {
225
225
const mockDefaultFn = __testRetryOnHelper ( 2 , 399 , 500 )
226
226
const retrySpy = jest . spyOn ( fetchClient , '__getRetryOn' )
227
227
fetchMock . mockResponse ( '500 Internal Server Error' , {
@@ -236,7 +236,7 @@ test('test exponentialBackoff with 3 retries on 5xx errors and custom retryOn',
236
236
retrySpy . mockRestore ( )
237
237
} )
238
238
239
- test ( 'test exponentialBackoff with default 3 retries on 5xx errors and custom retryOn as array' , async ( ) => {
239
+ test ( 'exponentialBackoff with default 3 retries on 5xx errors and custom retryOn as array' , async ( ) => {
240
240
const mockDefaultFn = [ 429 , 500 , 503 ]
241
241
fetchMock . mockResponse ( '429 Too Many Requests' , {
242
242
status : 429
@@ -245,7 +245,7 @@ test('test exponentialBackoff with default 3 retries on 5xx errors and custom re
245
245
expect ( result . status ) . toBe ( 429 )
246
246
} )
247
247
248
- test ( 'test exponentialBackoff with 3 retries on 5xx errors and custom retryDelay' , async ( ) => {
248
+ test ( 'exponentialBackoff with 3 retries on 5xx errors and custom retryDelay' , async ( ) => {
249
249
const mockDefaultFn1 = __testRetryDelayHelper ( 100 )
250
250
fetchMock . mockResponse ( '503 Service Unavailable' , {
251
251
status : 503 ,
@@ -256,7 +256,7 @@ test('test exponentialBackoff with 3 retries on 5xx errors and custom retryDelay
256
256
expect ( mockDefaultFn1 ) . toHaveBeenCalledTimes ( 2 )
257
257
} )
258
258
259
- test ( 'test exponentialBackoff with no retries on 4xx errors and custom retryDelay' , async ( ) => {
259
+ test ( 'exponentialBackoff with no retries on 4xx errors and custom retryDelay' , async ( ) => {
260
260
const mockDefaultFn = __testRetryDelayHelper ( 100 )
261
261
fetchMock . mockResponse ( '404 Not Found' , {
262
262
status : 404
0 commit comments