Skip to content

Commit

Permalink
Fix issues related to stubbing envs in createAsyncThunk.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaemami59 committed Sep 4, 2024
1 parent 2607c6e commit f7269a4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/toolkit/src/tests/createAsyncThunk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,19 +492,17 @@ describe('createAsyncThunk with abortController', () => {
describe('behavior with missing AbortController', () => {
let keepAbortController: (typeof window)['AbortController']
let freshlyLoadedModule: typeof import('../createAsyncThunk')
let nodeEnv: string

beforeEach(async () => {
keepAbortController = window.AbortController
delete (window as any).AbortController
vi.resetModules()
freshlyLoadedModule = await import('../createAsyncThunk')
nodeEnv = process.env.NODE_ENV!
;(process.env as any).NODE_ENV = 'development'
vi.stubEnv('NODE_ENV', 'development')
})

afterEach(() => {
;(process.env as any).NODE_ENV = nodeEnv
vi.unstubAllEnvs()
window.AbortController = keepAbortController
vi.resetModules()
})
Expand Down

0 comments on commit f7269a4

Please sign in to comment.