@@ -52,15 +52,8 @@ describe(`handleError`, () => {
5252
5353 await act ( ( ) => router . navigate ( "/page" ) ) ;
5454
55- expect ( spy . mock . calls ) . toEqual ( [
56- [
57- new Error ( "loader error!" ) ,
58- {
59- location : expect . objectContaining ( { pathname : "/page" } ) ,
60- errorInfo : undefined ,
61- } ,
62- ] ,
63- ] ) ;
55+ expect ( spy ) . toHaveBeenCalledWith ( new Error ( "loader error!" ) ) ;
56+ expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
6457 expect ( getHtml ( container ) ) . toContain ( "Error" ) ;
6558 } ) ;
6659
@@ -92,15 +85,8 @@ describe(`handleError`, () => {
9285 } ) ,
9386 ) ;
9487
95- expect ( spy . mock . calls ) . toEqual ( [
96- [
97- new Error ( "action error!" ) ,
98- {
99- location : expect . objectContaining ( { pathname : "/page" } ) ,
100- errorInfo : undefined ,
101- } ,
102- ] ,
103- ] ) ;
88+ expect ( spy ) . toHaveBeenCalledWith ( new Error ( "action error!" ) ) ;
89+ expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
10490 expect ( getHtml ( container ) ) . toContain ( "Error" ) ;
10591 } ) ;
10692
@@ -125,15 +111,8 @@ describe(`handleError`, () => {
125111
126112 await act ( ( ) => router . fetch ( "key" , "0" , "/fetch" ) ) ;
127113
128- expect ( spy . mock . calls ) . toEqual ( [
129- [
130- new Error ( "loader error!" ) ,
131- {
132- location : expect . objectContaining ( { pathname : "/" } ) ,
133- errorInfo : undefined ,
134- } ,
135- ] ,
136- ] ) ;
114+ expect ( spy ) . toHaveBeenCalledWith ( new Error ( "loader error!" ) ) ;
115+ expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
137116 expect ( getHtml ( container ) ) . toContain ( "Error" ) ;
138117 } ) ;
139118
@@ -163,15 +142,8 @@ describe(`handleError`, () => {
163142 } ) ,
164143 ) ;
165144
166- expect ( spy . mock . calls ) . toEqual ( [
167- [
168- new Error ( "action error!" ) ,
169- {
170- location : expect . objectContaining ( { pathname : "/" } ) ,
171- errorInfo : undefined ,
172- } ,
173- ] ,
174- ] ) ;
145+ expect ( spy ) . toHaveBeenCalledWith ( new Error ( "action error!" ) ) ;
146+ expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
175147 expect ( getHtml ( container ) ) . toContain ( "Error" ) ;
176148 } ) ;
177149
@@ -197,17 +169,13 @@ describe(`handleError`, () => {
197169
198170 await act ( ( ) => router . navigate ( "/page" ) ) ;
199171
200- expect ( spy . mock . calls ) . toEqual ( [
201- [
202- new Error ( "render error!" ) ,
203- {
204- location : expect . objectContaining ( { pathname : "/page" } ) ,
205- errorInfo : expect . objectContaining ( {
206- componentStack : expect . any ( String ) ,
207- } ) ,
208- } ,
209- ] ,
210- ] ) ;
172+ expect ( spy ) . toHaveBeenCalledWith (
173+ new Error ( "render error!" ) ,
174+ expect . objectContaining ( {
175+ componentStack : expect . any ( String ) ,
176+ } ) ,
177+ ) ;
178+ expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
211179 expect ( getHtml ( container ) ) . toContain ( "Error" ) ;
212180 } ) ;
213181
@@ -245,14 +213,8 @@ describe(`handleError`, () => {
245213 await act ( ( ) => router . navigate ( "/page" ) ) ;
246214 await waitFor ( ( ) => screen . getByText ( "Await Error" ) ) ;
247215
248- expect ( spy . mock . calls ) . toEqual ( [
249- [
250- new Error ( "await error!" ) ,
251- {
252- location : expect . objectContaining ( { pathname : "/page" } ) ,
253- } ,
254- ] ,
255- ] ) ;
216+ expect ( spy ) . toHaveBeenCalledWith ( new Error ( "await error!" ) ) ;
217+ expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
256218 expect ( getHtml ( container ) ) . toContain ( "Await Error" ) ;
257219 } ) ;
258220
@@ -296,17 +258,13 @@ describe(`handleError`, () => {
296258 await act ( ( ) => router . navigate ( "/page" ) ) ;
297259 await waitFor ( ( ) => screen . getByText ( "Await Error" ) ) ;
298260
299- expect ( spy . mock . calls ) . toEqual ( [
300- [
301- new Error ( "await error!" ) ,
302- {
303- location : expect . objectContaining ( { pathname : "/page" } ) ,
304- errorInfo : expect . objectContaining ( {
305- componentStack : expect . any ( String ) ,
306- } ) ,
307- } ,
308- ] ,
309- ] ) ;
261+ expect ( spy ) . toHaveBeenCalledWith (
262+ new Error ( "await error!" ) ,
263+ expect . objectContaining ( {
264+ componentStack : expect . any ( String ) ,
265+ } ) ,
266+ ) ;
267+ expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
310268 expect ( getHtml ( container ) ) . toContain ( "Await Error" ) ;
311269 } ) ;
312270
@@ -353,23 +311,14 @@ describe(`handleError`, () => {
353311 await act ( ( ) => router . navigate ( "/page" ) ) ;
354312 await waitFor ( ( ) => screen . getByText ( "Route Error" ) ) ;
355313
356- expect ( spy . mock . calls ) . toEqual ( [
357- [
358- new Error ( "await error!" ) ,
359- {
360- location : expect . objectContaining ( { pathname : "/page" } ) ,
361- } ,
362- ] ,
363- [
364- new Error ( "errorElement error!" ) ,
365- {
366- location : expect . objectContaining ( { pathname : "/page" } ) ,
367- errorInfo : expect . objectContaining ( {
368- componentStack : expect . any ( String ) ,
369- } ) ,
370- } ,
371- ] ,
372- ] ) ;
314+ expect ( spy ) . toHaveBeenCalledWith ( new Error ( "await error!" ) ) ;
315+ expect ( spy ) . toHaveBeenCalledWith (
316+ new Error ( "errorElement error!" ) ,
317+ expect . objectContaining ( {
318+ componentStack : expect . any ( String ) ,
319+ } ) ,
320+ ) ;
321+ expect ( spy ) . toHaveBeenCalledTimes ( 2 ) ;
373322 expect ( getHtml ( container ) ) . toContain ( "Route Error" ) ;
374323 } ) ;
375324
@@ -411,15 +360,8 @@ describe(`handleError`, () => {
411360
412361 await act ( ( ) => router . navigate ( "/page" ) ) ;
413362
414- expect ( spy . mock . calls ) . toEqual ( [
415- [
416- new Error ( "loader error!" ) ,
417- {
418- location : expect . objectContaining ( { pathname : "/page" } ) ,
419- errorInfo : undefined ,
420- } ,
421- ] ,
422- ] ) ;
363+ expect ( spy ) . toHaveBeenCalledWith ( new Error ( "loader error!" ) ) ;
364+ expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
423365 expect ( getHtml ( container ) ) . toContain ( "Error" ) ;
424366
425367 // Doesn't re-call on a fetcher update from a rendered error boundary
@@ -465,17 +407,13 @@ describe(`handleError`, () => {
465407
466408 await act ( ( ) => router . navigate ( "/page" ) ) ;
467409
468- expect ( spy . mock . calls ) . toEqual ( [
469- [
470- new Error ( "render error!" ) ,
471- {
472- location : expect . objectContaining ( { pathname : "/page" } ) ,
473- errorInfo : expect . objectContaining ( {
474- componentStack : expect . any ( String ) ,
475- } ) ,
476- } ,
477- ] ,
478- ] ) ;
410+ expect ( spy ) . toHaveBeenCalledWith (
411+ new Error ( "render error!" ) ,
412+ expect . objectContaining ( {
413+ componentStack : expect . any ( String ) ,
414+ } ) ,
415+ ) ;
416+ expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
479417 expect ( getHtml ( container ) ) . toContain ( "Error" ) ;
480418
481419 // Doesn't re-call on a fetcher update from a rendered error boundary
0 commit comments