@@ -55,8 +55,6 @@ describe('injectMutation', () => {
5555 } ) )
5656 } )
5757
58- TestBed . tick ( )
59-
6058 mutation . mutate ( result )
6159 await vi . advanceTimersByTimeAsync ( 0 )
6260
@@ -434,8 +432,6 @@ describe('injectMutation', () => {
434432 } ) )
435433 } )
436434
437- TestBed . tick ( )
438-
439435 mutate ( )
440436
441437 await vi . advanceTimersByTimeAsync ( 0 )
@@ -564,21 +560,8 @@ describe('injectMutation', () => {
564560 // Start mutation
565561 mutation . mutate ( 'retry-test' )
566562
567- // Synchronize pending effects for each retry attempt
568- TestBed . tick ( )
569- await Promise . resolve ( )
570- await vi . advanceTimersByTimeAsync ( 10 )
571-
572- TestBed . tick ( )
573- await Promise . resolve ( )
574- await vi . advanceTimersByTimeAsync ( 10 )
575-
576- TestBed . tick ( )
577-
578- const stablePromise = app . whenStable ( )
579- await Promise . resolve ( )
580- await vi . advanceTimersByTimeAsync ( 10 )
581- await stablePromise
563+ await vi . advanceTimersByTimeAsync ( 30 )
564+ await app . whenStable ( )
582565
583566 expect ( mutation . isSuccess ( ) ) . toBe ( true )
584567 expect ( mutation . data ( ) ) . toBe ( 'processed: retry-test' )
@@ -621,14 +604,8 @@ describe('injectMutation', () => {
621604 mutation1 . mutate ( 'test1' )
622605 mutation2 . mutate ( 'test2' )
623606
624- // Synchronize pending effects
625- TestBed . tick ( )
626-
627- const stablePromise = app . whenStable ( )
628- // Flush microtasks to allow TanStack Query's scheduled notifications to process
629- await Promise . resolve ( )
630607 await vi . advanceTimersByTimeAsync ( 1 )
631- await stablePromise
608+ await app . whenStable ( )
632609
633610 expect ( mutation1 . isSuccess ( ) ) . toBe ( true )
634611 expect ( mutation1 . data ( ) ) . toBe ( 'mutation1: test1' )
@@ -673,14 +650,8 @@ describe('injectMutation', () => {
673650 // Start mutation
674651 mutation . mutate ( 'test' )
675652
676- // Synchronize pending effects
677- TestBed . tick ( )
678-
679- const stablePromise = app . whenStable ( )
680- // Flush microtasks to allow TanStack Query's scheduled notifications to process
681- await Promise . resolve ( )
682653 await vi . advanceTimersByTimeAsync ( 1 )
683- await stablePromise
654+ await app . whenStable ( )
684655
685656 expect ( onMutateCalled ) . toBe ( true )
686657 expect ( onSuccessCalled ) . toBe ( true )
@@ -710,14 +681,8 @@ describe('injectMutation', () => {
710681 // Start mutation
711682 mutation . mutate ( 'test' )
712683
713- // Synchronize pending effects
714- TestBed . tick ( )
715-
716- const stablePromise = app . whenStable ( )
717- // Flush microtasks to allow TanStack Query's scheduled notifications to process
718- await Promise . resolve ( )
719684 await vi . advanceTimersByTimeAsync ( 1 )
720- await stablePromise
685+ await app . whenStable ( )
721686
722687 // Synchronous mutations complete immediately
723688 expect ( mutation . isSuccess ( ) ) . toBe ( true )
0 commit comments