File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
packages/toolkit/src/tests Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change 1
1
import type { PayloadAction } from '@reduxjs/toolkit'
2
2
import { createSlice , createAction } from '@reduxjs/toolkit'
3
+ import {
4
+ mockConsole ,
5
+ createConsole ,
6
+ getLog ,
7
+ } from 'console-testing-library/pure'
3
8
4
9
describe ( 'createSlice' , ( ) => {
10
+ let restore : ( ) => void
11
+
12
+ beforeEach ( ( ) => {
13
+ restore = mockConsole ( createConsole ( ) )
14
+ } )
15
+
5
16
describe ( 'when slice is undefined' , ( ) => {
6
17
it ( 'should throw an error' , ( ) => {
7
18
expect ( ( ) =>
@@ -36,13 +47,13 @@ describe('createSlice', () => {
36
47
37
48
describe ( 'when initial state is undefined' , ( ) => {
38
49
it ( 'should throw an error' , ( ) => {
39
- expect ( ( ) =>
40
- createSlice ( {
41
- name : 'test' ,
42
- reducers : { } ,
43
- initialState : undefined ,
44
- } )
45
- ) . toThrowErrorMatchingInlineSnapshot ( `" initial state must be different of undefined"` )
50
+ createSlice ( {
51
+ name : 'test' ,
52
+ reducers : { } ,
53
+ initialState : undefined ,
54
+ } )
55
+
56
+ expect ( getLog ( ) . log ) . toBe ( ' initial state must be different of undefined' )
46
57
} )
47
58
} )
48
59
You can’t perform that action at this time.
0 commit comments