mirror of
https://github.com/hanzoai/msw.git
synced 2026-09-24 17:00:34 +00:00
test(finalize): use expect.poll vs waitFor
This commit is contained in:
@@ -172,9 +172,7 @@ it('runs immediately when scheduled after the request has been aborted', async (
|
|||||||
controller.abort()
|
controller.abort()
|
||||||
|
|
||||||
await expect(responsePromise).rejects.toThrow()
|
await expect(responsePromise).rejects.toThrow()
|
||||||
await vi.waitFor(() => {
|
await expect.poll(() => cleanup).toHaveBeenCalledOnce()
|
||||||
expect(cleanup).toHaveBeenCalledOnce()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('runs cleanups scheduled after the abort listener has fired', async () => {
|
it('runs cleanups scheduled after the abort listener has fired', async () => {
|
||||||
@@ -203,10 +201,8 @@ it('runs cleanups scheduled after the abort listener has fired', async () => {
|
|||||||
controller.abort()
|
controller.abort()
|
||||||
|
|
||||||
await expect(responsePromise).rejects.toThrow()
|
await expect(responsePromise).rejects.toThrow()
|
||||||
await vi.waitFor(() => {
|
await expect.poll(() => cleanupBeforeAbort).toHaveBeenCalledOnce()
|
||||||
expect(cleanupBeforeAbort).toHaveBeenCalledOnce()
|
await expect.poll(() => cleanupAfterAbort).toHaveBeenCalledOnce()
|
||||||
expect(cleanupAfterAbort).toHaveBeenCalledOnce()
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('runs once the generator resolver is exhausted', async () => {
|
it('runs once the generator resolver is exhausted', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user