File tree Expand file tree Collapse file tree 2 files changed +67
-2
lines changed Expand file tree Collapse file tree 2 files changed +67
-2
lines changed Original file line number Diff line number Diff line change 71
71
"electron" : " cross-env NODE_ENV=development electron ." ,
72
72
"build" : " cross-env NODE_ENV=production webpack --config webpack.config.production.js" ,
73
73
"build-bin" : " electron-builder -mwl" ,
74
- "test" : " cross-env NODE_ENV=test jest" ,
74
+ "test" : " cross-env NODE_ENV=test jest --verbose " ,
75
75
"test:clear" : " cross-env NODE_ENV=test jest --clearCache" ,
76
76
"linter" : " eslint src" ,
77
77
"develop" : " concurrently \" npm run dev\" \" npm run electron\" "
184
184
"extract-text-webpack-plugin" : " ^4.0.0-beta.0" ,
185
185
"html-webpack-plugin" : " ^3.1.0" ,
186
186
"identity-obj-proxy" : " ^3.0.0" ,
187
- "jest" : " ^23.6.0 " ,
187
+ "jest" : " ^25.2.6 " ,
188
188
"node-sass" : " ^4.13.1" ,
189
189
"postcss-loader" : " ^2.1.6" ,
190
190
"redux-mock-store" : " ^1.5.4" ,
Original file line number Diff line number Diff line change
1
+ import * as reducers from '../leftReducers.ts' ;
2
+ import { initialApplicationState } from '../initialState.ts' ;
3
+
4
+ initialApplicationState . describe ( 'Left reducers' , ( ) => {
5
+ let state ;
6
+
7
+ // redefine the default state before each reducer test
8
+ beforeEach ( ( ) => {
9
+ state = {
10
+ editMode : - 1 ,
11
+ testing : 'testingReducer' ,
12
+ codeReadOnly : true ,
13
+ components : [
14
+ {
15
+ changed : true ,
16
+ childrenArray : [ { } ] ,
17
+ classBased : false ,
18
+ code : '....' ,
19
+ color : '#FF6D00' ,
20
+ focusChild : { } ,
21
+ focusChildId : - 1 ,
22
+ id : 1 ,
23
+ nextChildId : 3 ,
24
+ nextPropId : 2 ,
25
+ position : {
26
+ height : 850 ,
27
+ width : 500 ,
28
+ x : 70 ,
29
+ y : 100
30
+ } ,
31
+ props : [ ] ,
32
+ stateful : false ,
33
+ title : 'App'
34
+ }
35
+ ]
36
+ } ;
37
+ } ) ;
38
+
39
+ describe ( 'toggleComponentState' , ( ) => {
40
+ it ( 'inverts the statefulness of component passed in' , ( ) => { } ) ;
41
+ } ) ;
42
+
43
+ // toggleEditMode reducer allows changing of component names in left container
44
+ describe ( 'toggleEditMode reducer' , ( ) => {
45
+ it ( 'should return the same state if id === 1' , ( ) => {
46
+ const action = {
47
+ type : 'EDIT_MODE' ,
48
+ payload : { id : 1 }
49
+ } ;
50
+
51
+ const newState = reducers . toggleEditMode ( state , action . payload ) ;
52
+ expect ( newState ) . toStrictEqual ( state ) ;
53
+ } ) ;
54
+
55
+ it ( 'should return new state with updated editMode' , ( ) => {
56
+ const action = {
57
+ type : 'EDIT_MODE' ,
58
+ payload : { id : 2 }
59
+ } ;
60
+
61
+ const newState = reducers . toggleEditMode ( state , action . payload ) ;
62
+ expect ( newState . editMode ) . toEqual ( action . payload . id ) ;
63
+ } ) ;
64
+ } ) ;
65
+ } ) ;
You can’t perform that action at this time.
0 commit comments