diff --git a/packages/query-core/src/__tests__/notifyManager.test.tsx b/packages/query-core/src/__tests__/notifyManager.test.tsx index ea13421455..3eeb960101 100644 --- a/packages/query-core/src/__tests__/notifyManager.test.tsx +++ b/packages/query-core/src/__tests__/notifyManager.test.tsx @@ -39,7 +39,7 @@ describe('notifyManager', () => { }) notifyManagerTest.batch(callbackBatchLevel1Spy) - await vi.advanceTimersByTimeAsync(20) + await vi.advanceTimersByTimeAsync(0) expect(callbackBatchLevel1Spy).toHaveBeenCalledTimes(1) expect(callbackBatchLevel2Spy).toHaveBeenCalledTimes(1) expect(callbackScheduleSpy).toHaveBeenCalledTimes(1) @@ -57,9 +57,7 @@ describe('notifyManager', () => { expect(customCallback).toHaveBeenCalledOnce() - // wait until the microtask has run - await new Promise((res) => queueMicrotask(res)) - + await vi.advanceTimersByTimeAsync(0) expect(notifySpy).toHaveBeenCalledTimes(1) })