@@ -92,49 +92,16 @@ test('onFetchedProjectData new loads project data into vm', () => {
92
92
expect ( resultState . projectData ) . toBe ( '1010101' ) ;
93
93
} ) ;
94
94
95
- // onLoadedProject: LOADING_VM_WITH_ID
96
-
97
- test ( 'onLoadedProject (LOADING_VM_WITH_ID, true, true) shows with id' , ( ) => {
98
- const initialState = {
99
- loadingState : LoadingState . LOADING_VM_WITH_ID
100
- } ;
101
- const action = onLoadedProject ( initialState . loadingState , true , true ) ;
102
- const resultState = projectStateReducer ( initialState , action ) ;
103
- expect ( resultState . loadingState ) . toBe ( LoadingState . SHOWING_WITH_ID ) ;
104
- } ) ;
105
-
106
- test ( 'onLoadedProject (LOADING_VM_WITH_ID, false, true) shows with id' , ( ) => {
107
- const initialState = {
108
- loadingState : LoadingState . LOADING_VM_WITH_ID
109
- } ;
110
- const action = onLoadedProject ( initialState . loadingState , true , true ) ;
111
- const resultState = projectStateReducer ( initialState , action ) ;
112
- expect ( resultState . loadingState ) . toBe ( LoadingState . SHOWING_WITH_ID ) ;
113
- } ) ;
114
-
115
- test ( 'onLoadedProject (LOADING_VM_WITH_ID, false, false), with project id, shows with id' , ( ) => {
95
+ test ( 'onLoadedProject upload, with canSave false, shows without id' , ( ) => {
116
96
const initialState = {
117
- loadingState : LoadingState . LOADING_VM_WITH_ID ,
118
- projectId : '12345'
119
- } ;
120
- const action = onLoadedProject ( initialState . loadingState , false , false ) ;
121
- const resultState = projectStateReducer ( initialState , action ) ;
122
- expect ( resultState . loadingState ) . toBe ( LoadingState . SHOWING_WITH_ID ) ;
123
- } ) ;
124
-
125
- test ( 'onLoadedProject (LOADING_VM_WITH_ID, false, false), with no project id, shows without id' , ( ) => {
126
- const initialState = {
127
- loadingState : LoadingState . LOADING_VM_WITH_ID ,
128
- projectId : null
97
+ loadingState : LoadingState . LOADING_VM_FILE_UPLOAD
129
98
} ;
130
- const action = onLoadedProject ( initialState . loadingState , false , false ) ;
99
+ const action = onLoadedProject ( initialState . loadingState , false , true ) ;
131
100
const resultState = projectStateReducer ( initialState , action ) ;
132
101
expect ( resultState . loadingState ) . toBe ( LoadingState . SHOWING_WITHOUT_ID ) ;
133
102
} ) ;
134
103
135
- // onLoadedProject: LOADING_VM_FILE_UPLOAD
136
-
137
- test ( 'onLoadedProject(LOADING_VM_FILE_UPLOAD, true, true) prepares to save' , ( ) => {
104
+ test ( 'onLoadedProject upload, with canSave true, prepares to save' , ( ) => {
138
105
const initialState = {
139
106
loadingState : LoadingState . LOADING_VM_FILE_UPLOAD
140
107
} ;
@@ -143,38 +110,25 @@ test('onLoadedProject(LOADING_VM_FILE_UPLOAD, true, true) prepares to save', ()
143
110
expect ( resultState . loadingState ) . toBe ( LoadingState . AUTO_UPDATING ) ;
144
111
} ) ;
145
112
146
- test ( 'onLoadedProject (LOADING_VM_FILE_UPLOAD, false, true) shows without id' , ( ) => {
113
+ test ( 'onLoadedProject with id shows with id' , ( ) => {
147
114
const initialState = {
148
- loadingState : LoadingState . LOADING_VM_FILE_UPLOAD
149
- } ;
150
- const action = onLoadedProject ( initialState . loadingState , false , true ) ;
151
- const resultState = projectStateReducer ( initialState , action ) ;
152
- expect ( resultState . loadingState ) . toBe ( LoadingState . SHOWING_WITHOUT_ID ) ;
153
- } ) ;
154
-
155
- test ( 'onLoadedProject (LOADING_VM_FILE_UPLOAD, false, false), with project id, shows with id' , ( ) => {
156
- const initialState = {
157
- loadingState : LoadingState . LOADING_VM_FILE_UPLOAD ,
158
- projectId : '12345'
115
+ loadingState : LoadingState . LOADING_VM_WITH_ID
159
116
} ;
160
- const action = onLoadedProject ( initialState . loadingState , false , false ) ;
117
+ const action = onLoadedProject ( initialState . loadingState , true , true ) ;
161
118
const resultState = projectStateReducer ( initialState , action ) ;
162
119
expect ( resultState . loadingState ) . toBe ( LoadingState . SHOWING_WITH_ID ) ;
163
120
} ) ;
164
121
165
- test ( 'onLoadedProject (LOADING_VM_FILE_UPLOAD, false, false), with no project id, shows without id' , ( ) => {
122
+ test ( 'onLoadedProject new shows without id' , ( ) => {
166
123
const initialState = {
167
- loadingState : LoadingState . LOADING_VM_FILE_UPLOAD ,
168
- projectId : null
124
+ loadingState : LoadingState . LOADING_VM_NEW_DEFAULT
169
125
} ;
170
- const action = onLoadedProject ( initialState . loadingState , false , false ) ;
126
+ const action = onLoadedProject ( initialState . loadingState , false , true ) ;
171
127
const resultState = projectStateReducer ( initialState , action ) ;
172
128
expect ( resultState . loadingState ) . toBe ( LoadingState . SHOWING_WITHOUT_ID ) ;
173
129
} ) ;
174
130
175
- // onLoadedProject: LOADING_VM_NEW_DEFAULT
176
-
177
- test ( 'onLoadedProject (LOADING_VM_NEW_DEFAULT, true, true) shows without id' , ( ) => {
131
+ test ( 'onLoadedProject new, to save shows without id' , ( ) => {
178
132
const initialState = {
179
133
loadingState : LoadingState . LOADING_VM_NEW_DEFAULT
180
134
} ;
@@ -183,26 +137,26 @@ test('onLoadedProject (LOADING_VM_NEW_DEFAULT, true, true) shows without id', ()
183
137
expect ( resultState . loadingState ) . toBe ( LoadingState . SHOWING_WITHOUT_ID ) ;
184
138
} ) ;
185
139
186
- test ( 'onLoadedProject (LOADING_VM_NEW_DEFAULT, false, true) shows without id' , ( ) => {
140
+ test ( 'onLoadedProject with success false, no project id, shows without id' , ( ) => {
187
141
const initialState = {
188
- loadingState : LoadingState . LOADING_VM_NEW_DEFAULT
142
+ loadingState : LoadingState . LOADING_VM_WITH_ID ,
143
+ projectId : null
189
144
} ;
190
- const action = onLoadedProject ( initialState . loadingState , false , true ) ;
145
+ const action = onLoadedProject ( initialState . loadingState , false , false ) ;
191
146
const resultState = projectStateReducer ( initialState , action ) ;
192
147
expect ( resultState . loadingState ) . toBe ( LoadingState . SHOWING_WITHOUT_ID ) ;
193
148
} ) ;
194
149
195
- test ( 'onLoadedProject (LOADING_VM_NEW_DEFAULT, false, false) shows error ' , ( ) => {
150
+ test ( 'onLoadedProject with success false, valid project id, shows with id ' , ( ) => {
196
151
const initialState = {
197
- loadingState : LoadingState . LOADING_VM_NEW_DEFAULT
152
+ loadingState : LoadingState . LOADING_VM_WITH_ID ,
153
+ projectId : '12345'
198
154
} ;
199
155
const action = onLoadedProject ( initialState . loadingState , false , false ) ;
200
156
const resultState = projectStateReducer ( initialState , action ) ;
201
- expect ( resultState . loadingState ) . toBe ( LoadingState . ERROR ) ;
157
+ expect ( resultState . loadingState ) . toBe ( LoadingState . SHOWING_WITH_ID ) ;
202
158
} ) ;
203
159
204
- // doneUpdatingProject
205
-
206
160
test ( 'doneUpdatingProject with id shows with id' , ( ) => {
207
161
const initialState = {
208
162
loadingState : LoadingState . MANUAL_UPDATING
0 commit comments