@@ -10,38 +10,38 @@ import App, { dataReducer, Counter } from './App';
1010
1111const list = [ 'a' , 'b' , 'c' ] ;
1212
13- describe ( 'Reducer Test' , ( ) => {
14- it ( 'should set a list' , ( ) => {
15- const state = { list : [ ] , error : null } ;
16- const newState = dataReducer ( state , {
17- type : 'SET_LIST' ,
18- list,
13+ describe ( 'App' , ( ) => {
14+ describe ( 'Reducer' , ( ) => {
15+ it ( 'should set a list' , ( ) => {
16+ const state = { list : [ ] , error : null } ;
17+ const newState = dataReducer ( state , {
18+ type : 'SET_LIST' ,
19+ list,
20+ } ) ;
21+
22+ expect ( newState ) . toEqual ( { list, error : null } ) ;
1923 } ) ;
2024
21- expect ( newState ) . toEqual ( { list, error : null } ) ;
22- } ) ;
25+ it ( 'should reset the error if list is set' , ( ) => {
26+ const state = { list : [ ] , error : true } ;
27+ const newState = dataReducer ( state , {
28+ type : 'SET_LIST' ,
29+ list,
30+ } ) ;
2331
24- it ( 'should reset the error if list is set' , ( ) => {
25- const state = { list : [ ] , error : true } ;
26- const newState = dataReducer ( state , {
27- type : 'SET_LIST' ,
28- list,
32+ expect ( newState ) . toEqual ( { list, error : null } ) ;
2933 } ) ;
3034
31- expect ( newState ) . toEqual ( { list, error : null } ) ;
32- } ) ;
35+ it ( 'should set the error' , ( ) => {
36+ const state = { list : [ ] , error : null } ;
37+ const newState = dataReducer ( state , {
38+ type : 'SET_ERROR' ,
39+ } ) ;
3340
34- it ( 'should set the error' , ( ) => {
35- const state = { list : [ ] , error : null } ;
36- const newState = dataReducer ( state , {
37- type : 'SET_ERROR' ,
41+ expect ( newState . error ) . toBeTruthy ( ) ;
3842 } ) ;
39-
40- expect ( newState . error ) . toBeTruthy ( ) ;
4143 } ) ;
42- } ) ;
4344
44- describe ( 'App' , ( ) => {
4545 test ( 'snapshot renders' , ( ) => {
4646 const component = renderer . create ( < App /> ) ;
4747 let tree = component . toJSON ( ) ;
0 commit comments