Skip to content

Commit

Permalink
Fix issues related to stubbing envs in getDefaultMiddleware.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaemami59 committed Sep 4, 2024
1 parent f7269a4 commit 4a5972b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/toolkit/src/tests/getDefaultMiddleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ import { buildGetDefaultMiddleware } from '@internal/getDefaultMiddleware'
const getDefaultMiddleware = buildGetDefaultMiddleware()

describe('getDefaultMiddleware', () => {
const ORIGINAL_NODE_ENV = process.env.NODE_ENV

afterEach(() => {
process.env.NODE_ENV = ORIGINAL_NODE_ENV
vi.unstubAllEnvs()
})

describe('Production behavior', () => {
Expand All @@ -26,7 +24,8 @@ describe('getDefaultMiddleware', () => {
})

it('returns an array with only redux-thunk in production', async () => {
process.env.NODE_ENV = 'production'
vi.stubEnv('NODE_ENV', 'production')

const { thunk } = await import('redux-thunk')
const { buildGetDefaultMiddleware } = await import(
'@internal/getDefaultMiddleware'
Expand Down

0 comments on commit 4a5972b

Please sign in to comment.