@@ -142,62 +142,6 @@ describe('useSWR - error', () => {
142
142
screen . getByText ( 'error: 0' )
143
143
} )
144
144
145
- it ( 'should not retry when shouldRetryOnError function returns false' , async ( ) => {
146
- const key = createKey ( )
147
- let count = 0
148
- function Page ( ) {
149
- const { data, error } = useSWR (
150
- key ,
151
- ( ) => createResponse ( new Error ( 'error: ' + count ++ ) , { delay : 100 } ) ,
152
- {
153
- onErrorRetry : ( _ , __ , ___ , revalidate , revalidateOpts ) => {
154
- revalidate ( revalidateOpts )
155
- } ,
156
- dedupingInterval : 0 ,
157
- shouldRetryOnError : ( ) => false
158
- }
159
- )
160
- if ( error ) return < div > { error . message } </ div >
161
- return < div > hello, { data } </ div >
162
- }
163
- renderWithConfig ( < Page /> )
164
- screen . getByText ( 'hello,' )
165
-
166
- // mount
167
- await screen . findByText ( 'error: 0' )
168
-
169
- await act ( ( ) => sleep ( 150 ) )
170
- screen . getByText ( 'error: 0' )
171
- } )
172
-
173
- it ( 'should retry when shouldRetryOnError function returns true' , async ( ) => {
174
- const key = createKey ( )
175
- let count = 0
176
- function Page ( ) {
177
- const { data, error } = useSWR (
178
- key ,
179
- ( ) => createResponse ( new Error ( 'error: ' + count ++ ) , { delay : 100 } ) ,
180
- {
181
- onErrorRetry : ( _ , __ , ___ , revalidate , revalidateOpts ) => {
182
- revalidate ( revalidateOpts )
183
- } ,
184
- dedupingInterval : 0 ,
185
- shouldRetryOnError : ( ) => true
186
- }
187
- )
188
- if ( error ) return < div > { error . message } </ div >
189
- return < div > hello, { data } </ div >
190
- }
191
- renderWithConfig ( < Page /> )
192
- screen . getByText ( 'hello,' )
193
-
194
- // mount
195
- await screen . findByText ( 'error: 0' )
196
-
197
- await act ( ( ) => sleep ( 150 ) )
198
- screen . getByText ( 'error: 1' )
199
- } )
200
-
201
145
it ( 'should trigger the onLoadingSlow and onSuccess event' , async ( ) => {
202
146
const key = createKey ( )
203
147
let loadingSlow = null ,
0 commit comments