blob: 90de1e327fc07ade292915ba9161956e0e68b79e [file] [log] [blame]
Einav Weiss Keidar1801b242018-08-13 16:19:46 +03001/*
2 * Copyright © 2016-2018 European Support Limited
AviZi280f8012017-06-09 02:39:56 +03003 *
Michael Landoefa037d2017-02-19 12:57:33 +02004 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
AviZi280f8012017-06-09 02:39:56 +03007 *
Einav Weiss Keidar1801b242018-08-13 16:19:46 +03008 * http://www.apache.org/licenses/LICENSE-2.0
AviZi280f8012017-06-09 02:39:56 +03009 *
Michael Landoefa037d2017-02-19 12:57:33 +020010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
Michael Landoefa037d2017-02-19 12:57:33 +020015 */
Michael Landoefa037d2017-02-19 12:57:33 +020016import deepFreeze from 'deep-freeze';
17import mockRest from 'test-utils/MockRest.js';
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030018import { cloneAndSet } from 'test-utils/Util.js';
19import { storeCreator } from 'sdc-app/AppStore.js';
Michael Landoefa037d2017-02-19 12:57:33 +020020import Configuration from 'sdc-app/config/Configuration.js';
21import SoftwareProductProcessesActionHelper from 'sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesActionHelper.js';
AviZi280f8012017-06-09 02:39:56 +030022import {
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030023 VSPProcessPostFactory,
24 VSPProcessStoreFactory,
25 VSPProcessPostFactoryWithType,
26 VSPProcessStoreFactoryWithType,
27 VSPProcessStoreWithFormDataFactory,
28 VSPProcessPostWithFormDataFactory,
29 VSPProcessStoreWithArtifactNameFactory
30} from 'test-utils/factories/softwareProduct/SoftwareProductProcessFactories.js';
31import { buildFromExistingObject } from 'test-utils/Util.js';
32import { VSPEditorFactory } from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
talig8e9c0652017-12-20 14:30:43 +020033import VersionFactory from 'test-utils/factories/common/VersionFactory.js';
Michael Landoefa037d2017-02-19 12:57:33 +020034
35const softwareProductId = '123';
talig8e9c0652017-12-20 14:30:43 +020036const version = VersionFactory.build();
Michael Landoefa037d2017-02-19 12:57:33 +020037
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030038describe('Software Product Processes Module Tests', function() {
39 let restPrefix = '';
Michael Landoefa037d2017-02-19 12:57:33 +020040
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030041 beforeAll(function() {
42 restPrefix = Configuration.get('restPrefix');
43 deepFreeze(restPrefix);
44 });
Michael Landoefa037d2017-02-19 12:57:33 +020045
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030046 //**
47 //** ADD
48 //**
49 it('Add Software Products Processes', () => {
50 const store = storeCreator();
51 deepFreeze(store.getState());
Michael Landoefa037d2017-02-19 12:57:33 +020052
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030053 const softwareProductProcessFromResponse = 'ADDED_ID';
Michael Landoefa037d2017-02-19 12:57:33 +020054
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030055 const softwareProductProcessAfterAdd = VSPProcessStoreFactory.build({
56 id: softwareProductProcessFromResponse
57 });
58 const softwareProductPostRequest = buildFromExistingObject(
59 VSPProcessPostFactory,
60 softwareProductProcessAfterAdd
61 );
Michael Landoefa037d2017-02-19 12:57:33 +020062
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030063 const expectedStore = cloneAndSet(
64 store.getState(),
65 'softwareProduct.softwareProductProcesses.processesList',
66 [softwareProductProcessAfterAdd]
67 );
AviZi280f8012017-06-09 02:39:56 +030068
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030069 mockRest.addHandler('post', ({ data, options, baseUrl }) => {
70 expect(baseUrl).toEqual(
71 `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
72 version.id
73 }/processes`
74 );
75 expect(data).toEqual(softwareProductPostRequest);
76 expect(options).toEqual(undefined);
77 return {
78 returnCode: 'OK',
79 value: softwareProductProcessFromResponse
80 };
81 });
Michael Landoefa037d2017-02-19 12:57:33 +020082
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030083 return SoftwareProductProcessesActionHelper.saveProcess(
84 store.dispatch,
85 {
86 softwareProductId,
87 version,
88 previousProcess: null,
89 process: softwareProductPostRequest
90 }
91 ).then(() => {
92 expect(store.getState()).toEqual(expectedStore);
93 });
94 });
Michael Landoefa037d2017-02-19 12:57:33 +020095
Einav Weiss Keidar1801b242018-08-13 16:19:46 +030096 it('Add Software Products Processes with type', () => {
97 const store = storeCreator();
98 deepFreeze(store.getState());
Michael Landoefa037d2017-02-19 12:57:33 +020099
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300100 const softwareProductProcessFromResponse = 'ADDED_ID';
Michael Landoefa037d2017-02-19 12:57:33 +0200101
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300102 const softwareProductProcessAfterAdd = VSPProcessStoreFactoryWithType.build(
103 { id: softwareProductProcessFromResponse }
104 );
105 const softwareProductPostRequest = buildFromExistingObject(
106 VSPProcessPostFactoryWithType,
107 softwareProductProcessAfterAdd
108 );
AviZi280f8012017-06-09 02:39:56 +0300109
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300110 const expectedStore = cloneAndSet(
111 store.getState(),
112 'softwareProduct.softwareProductProcesses.processesList',
113 [softwareProductProcessAfterAdd]
114 );
AviZi280f8012017-06-09 02:39:56 +0300115
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300116 mockRest.addHandler('post', ({ data, options, baseUrl }) => {
117 expect(baseUrl).toEqual(
118 `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
119 version.id
120 }/processes`
121 );
122 expect(data).toEqual(softwareProductPostRequest);
123 expect(options).toEqual(undefined);
124 return {
125 returnCode: 'OK',
126 value: softwareProductProcessFromResponse
127 };
128 });
AviZi280f8012017-06-09 02:39:56 +0300129
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300130 return SoftwareProductProcessesActionHelper.saveProcess(
131 store.dispatch,
132 {
133 softwareProductId,
134 version,
135 previousProcess: null,
136 process: softwareProductPostRequest
137 }
138 ).then(() => {
139 expect(store.getState()).toEqual(expectedStore);
140 });
141 });
AviZi280f8012017-06-09 02:39:56 +0300142
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300143 it('Add Software Products Processes with uploaded file', () => {
144 const store = storeCreator();
145 deepFreeze(store.getState());
AviZi280f8012017-06-09 02:39:56 +0300146
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300147 const softwareProductPostRequest = VSPProcessPostFactoryWithType.build();
148 const softwareProductProcessToAdd = VSPProcessPostWithFormDataFactory.build(
149 softwareProductPostRequest
150 );
151 const softwareProductProcessAfterAdd = VSPProcessStoreWithFormDataFactory.build();
AviZi280f8012017-06-09 02:39:56 +0300152
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300153 const expectedStore = cloneAndSet(
154 store.getState(),
155 'softwareProduct.softwareProductProcesses.processesList',
156 [softwareProductProcessAfterAdd]
157 );
AviZi280f8012017-06-09 02:39:56 +0300158
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300159 mockRest.addHandler('post', ({ data, options, baseUrl }) => {
160 expect(baseUrl).toEqual(
161 `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
162 version.id
163 }/processes`
164 );
165 expect(data).toEqual(softwareProductPostRequest);
166 expect(options).toEqual(undefined);
167 return {
168 returnCode: 'OK',
169 value: softwareProductProcessAfterAdd.id
170 };
171 });
AviZi280f8012017-06-09 02:39:56 +0300172
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300173 mockRest.addHandler('post', ({ data, options, baseUrl }) => {
174 expect(baseUrl).toEqual(
175 `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
176 version.id
177 }/processes/${softwareProductProcessAfterAdd.id}/upload`
178 );
179 expect(data).toEqual(softwareProductProcessToAdd.formData);
180 expect(options).toEqual(undefined);
181 return { returnCode: 'OK' };
182 });
Michael Landoefa037d2017-02-19 12:57:33 +0200183
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300184 return SoftwareProductProcessesActionHelper.saveProcess(
185 store.dispatch,
186 {
187 softwareProductId,
188 version,
189 previousProcess: null,
190 process: softwareProductProcessToAdd
191 }
192 ).then(() => {
193 expect(store.getState()).toEqual(expectedStore);
194 });
195 });
Michael Landoefa037d2017-02-19 12:57:33 +0200196
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300197 //**
198 //** UPDATE
199 //**
200 it('Update Software Products Processes', () => {
201 const softwareProductProcessesList = VSPProcessStoreWithArtifactNameFactory.buildList(
202 1
203 );
204 deepFreeze(softwareProductProcessesList);
Michael Landoefa037d2017-02-19 12:57:33 +0200205
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300206 const store = storeCreator({
207 softwareProduct: {
208 softwareProductProcesses: {
209 processesList: softwareProductProcessesList
210 }
211 }
212 });
213 deepFreeze(store.getState());
Michael Landoefa037d2017-02-19 12:57:33 +0200214
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300215 const toBeUpdatedProcessId = softwareProductProcessesList[0].id;
216 const previousProcessData = softwareProductProcessesList[0];
217 const processUpdateData = VSPProcessStoreWithArtifactNameFactory.build({
218 ...previousProcessData,
219 name: 'Pr1_UPDATED',
220 description: 'string_UPDATED',
221 type: 'Other'
222 });
Michael Landoefa037d2017-02-19 12:57:33 +0200223
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300224 deepFreeze(processUpdateData);
Michael Landoefa037d2017-02-19 12:57:33 +0200225
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300226 const processPutRequest = VSPProcessPostFactory.build({
227 name: 'Pr1_UPDATED',
228 description: 'string_UPDATED',
229 type: 'Other'
230 });
231 deepFreeze(processPutRequest);
Michael Landoefa037d2017-02-19 12:57:33 +0200232
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300233 const expectedStore = cloneAndSet(
234 store.getState(),
235 'softwareProduct.softwareProductProcesses.processesList',
236 [processUpdateData]
237 );
Michael Landoefa037d2017-02-19 12:57:33 +0200238
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300239 mockRest.addHandler('put', ({ data, options, baseUrl }) => {
240 expect(baseUrl).toEqual(
241 `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
242 version.id
243 }/processes/${toBeUpdatedProcessId}`
244 );
245 expect(data).toEqual(processPutRequest);
246 expect(options).toEqual(undefined);
247 return { returnCode: 'OK' };
248 });
Michael Landoefa037d2017-02-19 12:57:33 +0200249
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300250 return SoftwareProductProcessesActionHelper.saveProcess(
251 store.dispatch,
252 {
253 softwareProductId,
254 version,
255 previousProcess: previousProcessData,
256 process: processUpdateData
257 }
258 ).then(() => {
259 expect(store.getState()).toEqual(expectedStore);
260 });
261 });
Michael Landoefa037d2017-02-19 12:57:33 +0200262
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300263 it('Update Software Products Processes and uploaded file', () => {
264 const previousProcessData = VSPProcessStoreWithArtifactNameFactory.build();
265 deepFreeze(previousProcessData);
AviZi280f8012017-06-09 02:39:56 +0300266
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300267 const store = storeCreator({
268 softwareProduct: {
269 softwareProductProcesses: {
270 processesList: [previousProcessData]
271 }
272 }
273 });
274 deepFreeze(store.getState());
Michael Landoefa037d2017-02-19 12:57:33 +0200275
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300276 const newProcessToUpdate = VSPProcessStoreWithFormDataFactory.build({
277 ...previousProcessData,
278 name: 'new name',
279 formData: {
280 name: 'new artifact name'
281 }
282 });
283 deepFreeze(newProcessToUpdate);
Michael Landoefa037d2017-02-19 12:57:33 +0200284
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300285 const newProcessToPutRequest = VSPProcessPostFactory.build({
286 name: newProcessToUpdate.name,
287 description: previousProcessData.description,
288 type: previousProcessData.type
289 });
290 deepFreeze(newProcessToPutRequest);
Michael Landoefa037d2017-02-19 12:57:33 +0200291
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300292 const expectedStore = cloneAndSet(
293 store.getState(),
294 'softwareProduct.softwareProductProcesses.processesList',
295 [newProcessToUpdate]
296 );
Michael Landoefa037d2017-02-19 12:57:33 +0200297
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300298 mockRest.addHandler('put', ({ data, options, baseUrl }) => {
299 expect(baseUrl).toEqual(
300 `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
301 version.id
302 }/processes/${newProcessToUpdate.id}`
303 );
304 expect(data).toEqual(newProcessToPutRequest);
305 expect(options).toEqual(undefined);
306 return { returnCode: 'OK' };
307 });
Michael Landoefa037d2017-02-19 12:57:33 +0200308
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300309 mockRest.addHandler('post', ({ data, options, baseUrl }) => {
310 expect(baseUrl).toEqual(
311 `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
312 version.id
313 }/processes/${newProcessToUpdate.id}/upload`
314 );
315 expect(data).toEqual(newProcessToUpdate.formData);
316 expect(options).toEqual(undefined);
317 return { returnCode: 'OK' };
318 });
Michael Landoefa037d2017-02-19 12:57:33 +0200319
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300320 return SoftwareProductProcessesActionHelper.saveProcess(
321 store.dispatch,
322 {
323 softwareProductId,
324 version,
325 previousProcess: previousProcessData,
326 process: newProcessToUpdate
327 }
328 ).then(() => {
329 expect(store.getState()).toEqual(expectedStore);
330 });
331 });
Michael Landoefa037d2017-02-19 12:57:33 +0200332
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300333 //**
334 //** GET
335 //**
336 it('Get Software Products Processes List', () => {
337 const store = storeCreator();
338 deepFreeze(store.getState());
Michael Landoefa037d2017-02-19 12:57:33 +0200339
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300340 const softwareProductProcessesList = VSPProcessStoreFactory.buildList(
341 2
342 );
Michael Landoefa037d2017-02-19 12:57:33 +0200343
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300344 deepFreeze(softwareProductProcessesList);
Michael Landoefa037d2017-02-19 12:57:33 +0200345
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300346 deepFreeze(store.getState());
Michael Landoefa037d2017-02-19 12:57:33 +0200347
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300348 const expectedStore = cloneAndSet(
349 store.getState(),
350 'softwareProduct.softwareProductProcesses.processesList',
351 softwareProductProcessesList
352 );
Michael Landoefa037d2017-02-19 12:57:33 +0200353
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300354 mockRest.addHandler('fetch', ({ options, data, baseUrl }) => {
355 expect(baseUrl).toEqual(
356 `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
357 version.id
358 }/processes`
359 );
360 expect(data).toEqual(undefined);
361 expect(options).toEqual(undefined);
362 return { results: softwareProductProcessesList };
363 });
Michael Landoefa037d2017-02-19 12:57:33 +0200364
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300365 return SoftwareProductProcessesActionHelper.fetchProcessesList(
366 store.dispatch,
367 { softwareProductId, version }
368 ).then(() => {
369 expect(store.getState()).toEqual(expectedStore);
370 });
371 });
Michael Landoefa037d2017-02-19 12:57:33 +0200372
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300373 //**
374 //** DELETE
375 //**
376 it('Delete Software Products Processes', () => {
377 const softwareProductProcessesList = VSPProcessStoreWithArtifactNameFactory.buildList(
378 1
379 );
380 const currentSoftwareProduct = VSPEditorFactory.build();
Michael Landoefa037d2017-02-19 12:57:33 +0200381
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300382 deepFreeze(softwareProductProcessesList);
383 const store = storeCreator({
384 softwareProduct: {
385 softwareProductProcesses: {
386 processesList: softwareProductProcessesList
387 },
388 softwareProductEditor: {
389 data: currentSoftwareProduct
390 }
391 }
392 });
Michael Landoefa037d2017-02-19 12:57:33 +0200393
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300394 const processId = softwareProductProcessesList[0].id;
395 const versionId = version.id;
396 deepFreeze(store.getState());
Michael Landoefa037d2017-02-19 12:57:33 +0200397
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300398 const expectedStore = cloneAndSet(
399 store.getState(),
400 'softwareProduct.softwareProductProcesses.processesList',
401 []
402 );
Michael Landoefa037d2017-02-19 12:57:33 +0200403
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300404 mockRest.addHandler('destroy', ({ data, options, baseUrl }) => {
405 expect(baseUrl).toEqual(
406 `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${versionId}/processes/${processId}`
407 );
408 expect(data).toEqual(undefined);
409 expect(options).toEqual(undefined);
410 return {
411 results: {
412 returnCode: 'OK'
413 }
414 };
415 });
Michael Landoefa037d2017-02-19 12:57:33 +0200416
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300417 return SoftwareProductProcessesActionHelper.deleteProcess(
418 store.dispatch,
419 {
420 process: softwareProductProcessesList[0],
421 softwareProductId,
422 version
423 }
424 ).then(() => {
425 expect(store.getState()).toEqual(expectedStore);
426 });
427 });
Michael Landoefa037d2017-02-19 12:57:33 +0200428
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300429 it('Validating Software Products Processes Delete confirmation', () => {
430 const store = storeCreator();
431 deepFreeze(store.getState());
Michael Landoefa037d2017-02-19 12:57:33 +0200432
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300433 let process = VSPProcessStoreFactory.build();
434 deepFreeze(process);
Michael Landoefa037d2017-02-19 12:57:33 +0200435
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300436 const expectedStore = cloneAndSet(
437 store.getState(),
438 'softwareProduct.softwareProductProcesses.processToDelete',
439 process
440 );
Michael Landoefa037d2017-02-19 12:57:33 +0200441
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300442 return SoftwareProductProcessesActionHelper.openDeleteProcessesConfirm(
443 store.dispatch,
444 { process }
445 );
Michael Landoefa037d2017-02-19 12:57:33 +0200446
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300447 expect(store.getState()).toEqual(expectedStore);
448 });
Michael Landoefa037d2017-02-19 12:57:33 +0200449
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300450 it('Validating Software Products Processes Cancel Delete', () => {
451 const store = storeCreator();
452 deepFreeze(store.getState());
Michael Landoefa037d2017-02-19 12:57:33 +0200453
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300454 const expectedStore = cloneAndSet(
455 store.getState(),
456 'softwareProduct.softwareProductProcesses.processToDelete',
457 false
458 );
Michael Landoefa037d2017-02-19 12:57:33 +0200459
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300460 SoftwareProductProcessesActionHelper.hideDeleteConfirm(store.dispatch);
Michael Landoefa037d2017-02-19 12:57:33 +0200461
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300462 expect(store.getState()).toEqual(expectedStore);
463 });
Michael Landoefa037d2017-02-19 12:57:33 +0200464
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300465 //**
466 //** CREATE/EDIT
467 //**
Michael Landoefa037d2017-02-19 12:57:33 +0200468
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300469 it('Validating close Software Products Processes from editing mode', () => {
470 const store = storeCreator();
471 deepFreeze(store.getState());
Michael Landoefa037d2017-02-19 12:57:33 +0200472
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300473 const expectedStore = cloneAndSet(
474 store.getState(),
475 'softwareProduct.softwareProductProcesses.processesEditor',
476 {}
477 );
Michael Landoefa037d2017-02-19 12:57:33 +0200478
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300479 SoftwareProductProcessesActionHelper.closeEditor(store.dispatch);
480 expect(store.getState()).toEqual(expectedStore);
481 });
Michael Landoefa037d2017-02-19 12:57:33 +0200482
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300483 it('Validating open Software Products Processes for editing', () => {
484 const store = storeCreator();
485 deepFreeze(store.getState());
Michael Landoefa037d2017-02-19 12:57:33 +0200486
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300487 let process = { name: 'aa', description: 'xx' };
488 deepFreeze(process);
Michael Landoefa037d2017-02-19 12:57:33 +0200489
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300490 const expectedStore = cloneAndSet(
491 store.getState(),
492 'softwareProduct.softwareProductProcesses.processesEditor.data',
493 process
494 );
Michael Landoefa037d2017-02-19 12:57:33 +0200495
Einav Weiss Keidar1801b242018-08-13 16:19:46 +0300496 SoftwareProductProcessesActionHelper.openEditor(store.dispatch, {
497 process
498 });
499 expect(
500 store.getState().softwareProduct.softwareProductProcesses
501 .processesEditor.data
502 ).toEqual(
503 expectedStore.softwareProduct.softwareProductProcesses
504 .processesEditor.data
505 );
506 });
Michael Landoefa037d2017-02-19 12:57:33 +0200507});