@@ -168,7 +168,7 @@ describe('useFetch - responseType', (): void => {
168168 expect ( result . current . loading ) . toBe ( true )
169169 await waitForNextUpdate ( )
170170 expect ( result . current . loading ) . toBe ( false )
171- expect ( result . current . error . name ) . toBe ( 'FetchError' )
171+ expect ( result . current . error ? .name ) . toBe ( 'FetchError' )
172172 } )
173173
174174 it ( 'should process .text() with default array responseType' , async ( ) : Promise < void > => {
@@ -353,8 +353,8 @@ describe('timeouts', (): void => {
353353 expect ( result . current . loading ) . toBe ( true )
354354 await waitForNextUpdate ( )
355355 expect ( result . current . loading ) . toBe ( false )
356- expect ( result . current . error . name ) . toBe ( 'AbortError' )
357- expect ( result . current . error . message ) . toBe ( 'Timeout Error' )
356+ expect ( result . current . error ? .name ) . toBe ( 'AbortError' )
357+ expect ( result . current . error ? .message ) . toBe ( 'Timeout Error' )
358358 expect ( onAbort ) . toBeCalled ( )
359359 expect ( onTimeout ) . toBeCalled ( )
360360 expect ( onAbort ) . toHaveBeenCalledTimes ( 1 )
@@ -386,8 +386,8 @@ describe('timeouts', (): void => {
386386 expect ( fetch . mock . calls [ 0 ] [ 0 ] ) . toBe ( 'https://example.com/todos' )
387387 expect ( fetch ) . toHaveBeenCalledTimes ( 2 )
388388 expect ( result . current . loading ) . toBe ( false )
389- expect ( result . current . error . name ) . toBe ( 'AbortError' )
390- expect ( result . current . error . message ) . toBe ( 'Timeout Error' )
389+ expect ( result . current . error ? .name ) . toBe ( 'AbortError' )
390+ expect ( result . current . error ? .message ) . toBe ( 'Timeout Error' )
391391 expect ( onAbort ) . toBeCalled ( )
392392 expect ( onTimeout ) . toBeCalled ( )
393393 expect ( onAbort ) . toHaveBeenCalledTimes ( 2 )
0 commit comments