Skip to content

Commit 8837536

Browse files
sukvvonmanudeli
andauthored
test(query-core/notifyManager): replace 'queueMicrotask' with 'advanceTimersByTimeAsync' (#9329)
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
1 parent 45dac6f commit 8837536

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

packages/query-core/src/__tests__/notifyManager.test.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe('notifyManager', () => {
3939
})
4040
notifyManagerTest.batch(callbackBatchLevel1Spy)
4141

42-
await vi.advanceTimersByTimeAsync(20)
42+
await vi.advanceTimersByTimeAsync(0)
4343
expect(callbackBatchLevel1Spy).toHaveBeenCalledTimes(1)
4444
expect(callbackBatchLevel2Spy).toHaveBeenCalledTimes(1)
4545
expect(callbackScheduleSpy).toHaveBeenCalledTimes(1)
@@ -57,9 +57,7 @@ describe('notifyManager', () => {
5757

5858
expect(customCallback).toHaveBeenCalledOnce()
5959

60-
// wait until the microtask has run
61-
await new Promise<void>((res) => queueMicrotask(res))
62-
60+
await vi.advanceTimersByTimeAsync(0)
6361
expect(notifySpy).toHaveBeenCalledTimes(1)
6462
})
6563

0 commit comments

Comments
 (0)