@@ -18,7 +18,7 @@ describe('createActions', () => {
1818 } )
1919 ) . to . throw (
2020 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'
2222 ) ;
2323 } ) ;
2424
@@ -32,7 +32,7 @@ describe('createActions', () => {
3232 } )
3333 ) . to . throw (
3434 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'
3636 ) ;
3737
3838 expect (
@@ -48,26 +48,7 @@ describe('createActions', () => {
4848 } )
4949 ) . to . throw (
5050 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'
7152 ) ;
7253 } ) ;
7354
@@ -78,7 +59,7 @@ describe('createActions', () => {
7859 } )
7960 ) . to . throw (
8061 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'
8263 ) ;
8364 } ) ;
8465
@@ -211,7 +192,8 @@ describe('createActions', () => {
211192 APP : {
212193 COUNTER : {
213194 INCREMENT : amount => ( { amount } ) ,
214- DECREMENT : amount => ( { amount : - amount } )
195+ DECREMENT : amount => ( { amount : - amount } ) ,
196+ SET : undefined
215197 } ,
216198 NOTIFY : ( username , message ) => ( { message : `${ username } : ${ message } ` } )
217199 } ,
@@ -226,6 +208,10 @@ describe('createActions', () => {
226208 type : 'APP/COUNTER/DECREMENT' ,
227209 payload : { amount : - 1 }
228210 } ) ;
211+ expect ( actionCreators . app . counter . set ( 100 ) ) . to . deep . equal ( {
212+ type : 'APP/COUNTER/SET' ,
213+ payload : 100
214+ } ) ;
229215 expect ( actionCreators . app . notify ( 'yangmillstheory' , 'Hello World' ) ) . to . deep . equal ( {
230216 type : 'APP/NOTIFY' ,
231217 payload : { message : 'yangmillstheory: Hello World' }
0 commit comments