Skip to content

Commit 9576c3d

Browse files
committed
Convert createSlice skip test to todo test
1 parent c8a5f3b commit 9576c3d

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import { vi } from 'vitest'
21
import type { PayloadAction, WithSlice } from '@reduxjs/toolkit'
32
import {
43
asyncThunkCreator,
54
buildCreateSlice,
6-
configureStore,
75
combineSlices,
8-
createSlice,
6+
configureStore,
97
createAction,
8+
createSlice,
109
} from '@reduxjs/toolkit'
1110
import {
12-
mockConsole,
1311
createConsole,
1412
getLog,
13+
mockConsole,
1514
} from 'console-testing-library/pure'
1615

1716
type CreateSlice = typeof createSlice
@@ -57,7 +56,6 @@ describe('createSlice', () => {
5756

5857
describe('when initial state is undefined', () => {
5958
beforeEach(() => {
60-
6159
vi.stubEnv('NODE_ENV', 'development')
6260

6361
return vi.unstubAllEnvs
@@ -445,25 +443,28 @@ describe('createSlice', () => {
445443
})
446444

447445
// TODO Determine final production behavior here
448-
it.skip('Crashes in production', () => {
449-
process.env.NODE_ENV = 'production'
446+
it.todo('Crashes in production', () => {
447+
vi.stubEnv('NODE_ENV', 'production')
448+
450449
const { createSlice } = require('../createSlice')
451450

452-
let dummySlice = (createSlice as CreateSlice)({
451+
const dummySlice = (createSlice as CreateSlice)({
453452
name: 'dummy',
454453
initialState: [],
455454
reducers: {},
456455
// @ts-ignore
457456
extraReducers: {},
458457
})
459458
const wrapper = () => {
460-
let reducer = dummySlice.reducer
459+
const { reducer } = dummySlice
461460
reducer(undefined, { type: 'dummy' })
462461
}
463462

464463
expect(wrapper).toThrowError(
465464
/The object notation for `createSlice.extraReducers` has been removed/
466465
)
466+
467+
vi.unstubAllEnvs()
467468
})
468469
})
469470
describe('slice selectors', () => {

0 commit comments

Comments
 (0)