Skip to content

Commit c23f7eb

Browse files
JulienKodemarkerikson
authored andcommitted
test: update spec for abort controller
1 parent 3055fbb commit c23f7eb

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

packages/toolkit/src/tests/createAsyncThunk.test.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -505,22 +505,15 @@ describe('createAsyncThunk with abortController', () => {
505505
vi.resetModules()
506506
})
507507

508-
test('calling `abort` on an asyncThunk works with a FallbackAbortController if no global abortController is not available', async () => {
508+
test('calling a thunk made with createAsyncThunk should fail if no global abortController is not available', async () => {
509509
const longRunningAsyncThunk = freshlyLoadedModule.createAsyncThunk(
510510
'longRunning',
511511
async () => {
512512
await new Promise((resolve) => setTimeout(resolve, 30000))
513513
}
514514
)
515515

516-
store.dispatch(longRunningAsyncThunk()).abort()
517-
// should only log once, even if called twice
518-
store.dispatch(longRunningAsyncThunk()).abort()
519-
520-
expect(getLog().log).toMatchInlineSnapshot(`
521-
"This platform does not implement AbortController.
522-
If you want to use the AbortController to react to \`abort\` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'."
523-
`)
516+
expect(longRunningAsyncThunk()).toThrow("AbortController is not defined")
524517
})
525518
})
526519
})

0 commit comments

Comments
 (0)