Skip to content

Commit

Permalink
Fix issues related to stubbing envs in createReducer.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaemami59 committed May 16, 2024
1 parent 8625470 commit ec60b9a
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions packages/toolkit/src/tests/createReducer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,12 @@ describe('createReducer', () => {
})

describe('Deprecation warnings', () => {
let originalNodeEnv = process.env.NODE_ENV

beforeEach(() => {
vi.resetModules()
})

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

it('Throws an error if the legacy object notation is used', async () => {
Expand Down Expand Up @@ -109,15 +107,13 @@ describe('createReducer', () => {
})

describe('Immer in a production environment', () => {
let originalNodeEnv = process.env.NODE_ENV

beforeEach(() => {
vi.resetModules()
process.env.NODE_ENV = 'production'
vi.stubEnv('NODE_ENV', 'production')
})

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

test('Freezes data in production', async () => {
Expand Down

0 comments on commit ec60b9a

Please sign in to comment.