@@ -18,7 +18,7 @@ describe('createActions', () => {
18
18
} )
19
19
) . to . throw (
20
20
Error ,
21
- 'Expected function, undefined, or array with payload and meta functions for ACTION_2'
21
+ 'Expected function, undefined, null, or array with payload and meta functions for ACTION_2'
22
22
) ;
23
23
} ) ;
24
24
@@ -32,7 +32,7 @@ describe('createActions', () => {
32
32
} )
33
33
) . to . throw (
34
34
Error ,
35
- 'Expected function, undefined, or array with payload and meta functions for ACTION_1'
35
+ 'Expected function, undefined, null, or array with payload and meta functions for ACTION_1'
36
36
) ;
37
37
38
38
expect (
@@ -48,26 +48,7 @@ describe('createActions', () => {
48
48
} )
49
49
) . to . throw (
50
50
Error ,
51
- 'Expected function, undefined, or array with payload and meta functions for ACTION_2'
52
- ) ;
53
- } ) ;
54
-
55
- it ( 'should throw an error if the reducer value is undefined in object form' , ( ) => {
56
- expect (
57
- ( ) => createActions ( { ACTION_1 : undefined } , 'ACTION_2' )
58
- ) . to . throw (
59
- Error ,
60
- 'Expected function, undefined, or array with payload and meta functions for ACTION_1'
61
- ) ;
62
-
63
- expect (
64
- ( ) => createActions ( {
65
- ACTION_1 : ( ) => { } ,
66
- ACTION_2 : undefined
67
- } )
68
- ) . to . throw (
69
- Error ,
70
- 'Expected function, undefined, or array with payload and meta functions for ACTION_2'
51
+ 'Expected function, undefined, null, or array with payload and meta functions for ACTION_2'
71
52
) ;
72
53
} ) ;
73
54
@@ -78,7 +59,7 @@ describe('createActions', () => {
78
59
} )
79
60
) . to . throw (
80
61
Error ,
81
- 'Expected function, undefined, or array with payload and meta functions for ACTION_1'
62
+ 'Expected function, undefined, null, or array with payload and meta functions for ACTION_1'
82
63
) ;
83
64
} ) ;
84
65
@@ -211,7 +192,8 @@ describe('createActions', () => {
211
192
APP : {
212
193
COUNTER : {
213
194
INCREMENT : amount => ( { amount } ) ,
214
- DECREMENT : amount => ( { amount : - amount } )
195
+ DECREMENT : amount => ( { amount : - amount } ) ,
196
+ SET : undefined
215
197
} ,
216
198
NOTIFY : ( username , message ) => ( { message : `${ username } : ${ message } ` } )
217
199
} ,
@@ -226,6 +208,10 @@ describe('createActions', () => {
226
208
type : 'APP/COUNTER/DECREMENT' ,
227
209
payload : { amount : - 1 }
228
210
} ) ;
211
+ expect ( actionCreators . app . counter . set ( 100 ) ) . to . deep . equal ( {
212
+ type : 'APP/COUNTER/SET' ,
213
+ payload : 100
214
+ } ) ;
229
215
expect ( actionCreators . app . notify ( 'yangmillstheory' , 'Hello World' ) ) . to . deep . equal ( {
230
216
type : 'APP/NOTIFY' ,
231
217
payload : { message : 'yangmillstheory: Hello World' }
0 commit comments