react 16 upgrade
Issue-ID: SDC-1762
Change-Id: I7701f12fc63bb09f8c985c7c893b984701dcbfab
Signed-off-by: Einav Keidar <einavw@amdocs.com>
diff --git a/openecomp-ui/test/softwareProduct/processes/test.js b/openecomp-ui/test/softwareProduct/processes/test.js
index 6ad696a..90de1e3 100644
--- a/openecomp-ui/test/softwareProduct/processes/test.js
+++ b/openecomp-ui/test/softwareProduct/processes/test.js
@@ -1,410 +1,507 @@
-/*!
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+/*
+ * Copyright © 2016-2018 European Support Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing
- * permissions and limitations under the License.
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
import deepFreeze from 'deep-freeze';
import mockRest from 'test-utils/MockRest.js';
-import {cloneAndSet} from 'test-utils/Util.js';
-import {storeCreator} from 'sdc-app/AppStore.js';
+import { cloneAndSet } from 'test-utils/Util.js';
+import { storeCreator } from 'sdc-app/AppStore.js';
import Configuration from 'sdc-app/config/Configuration.js';
import SoftwareProductProcessesActionHelper from 'sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesActionHelper.js';
import {
- VSPProcessPostFactory,
- VSPProcessStoreFactory,
- VSPProcessPostFactoryWithType,
- VSPProcessStoreFactoryWithType,
- VSPProcessStoreWithFormDataFactory,
- VSPProcessPostWithFormDataFactory,
- VSPProcessStoreWithArtifactNameFactory } from 'test-utils/factories/softwareProduct/SoftwareProductProcessFactories.js';
-import {buildFromExistingObject} from 'test-utils/Util.js';
-import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
+ VSPProcessPostFactory,
+ VSPProcessStoreFactory,
+ VSPProcessPostFactoryWithType,
+ VSPProcessStoreFactoryWithType,
+ VSPProcessStoreWithFormDataFactory,
+ VSPProcessPostWithFormDataFactory,
+ VSPProcessStoreWithArtifactNameFactory
+} from 'test-utils/factories/softwareProduct/SoftwareProductProcessFactories.js';
+import { buildFromExistingObject } from 'test-utils/Util.js';
+import { VSPEditorFactory } from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
import VersionFactory from 'test-utils/factories/common/VersionFactory.js';
const softwareProductId = '123';
const version = VersionFactory.build();
-describe('Software Product Processes Module Tests', function () {
+describe('Software Product Processes Module Tests', function() {
+ let restPrefix = '';
- let restPrefix = '';
+ beforeAll(function() {
+ restPrefix = Configuration.get('restPrefix');
+ deepFreeze(restPrefix);
+ });
- beforeAll(function() {
- restPrefix = Configuration.get('restPrefix');
- deepFreeze(restPrefix);
- });
+ //**
+ //** ADD
+ //**
+ it('Add Software Products Processes', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
- //**
- //** ADD
- //**
- it('Add Software Products Processes', () => {
+ const softwareProductProcessFromResponse = 'ADDED_ID';
- const store = storeCreator();
- deepFreeze(store.getState());
+ const softwareProductProcessAfterAdd = VSPProcessStoreFactory.build({
+ id: softwareProductProcessFromResponse
+ });
+ const softwareProductPostRequest = buildFromExistingObject(
+ VSPProcessPostFactory,
+ softwareProductProcessAfterAdd
+ );
- const softwareProductProcessFromResponse = 'ADDED_ID';
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processesList',
+ [softwareProductProcessAfterAdd]
+ );
- const softwareProductProcessAfterAdd = VSPProcessStoreFactory.build({id: softwareProductProcessFromResponse});
- const softwareProductPostRequest = buildFromExistingObject(VSPProcessPostFactory, softwareProductProcessAfterAdd);
+ mockRest.addHandler('post', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
+ version.id
+ }/processes`
+ );
+ expect(data).toEqual(softwareProductPostRequest);
+ expect(options).toEqual(undefined);
+ return {
+ returnCode: 'OK',
+ value: softwareProductProcessFromResponse
+ };
+ });
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', [softwareProductProcessAfterAdd]);
+ return SoftwareProductProcessesActionHelper.saveProcess(
+ store.dispatch,
+ {
+ softwareProductId,
+ version,
+ previousProcess: null,
+ process: softwareProductPostRequest
+ }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
- mockRest.addHandler('post', ({data, options, baseUrl}) => {
+ it('Add Software Products Processes with type', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
- expect(baseUrl).toEqual(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${version.id}/processes`);
- expect(data).toEqual(softwareProductPostRequest);
- expect(options).toEqual(undefined);
- return {
- returnCode: 'OK',
- value: softwareProductProcessFromResponse
- };
- });
+ const softwareProductProcessFromResponse = 'ADDED_ID';
- return SoftwareProductProcessesActionHelper.saveProcess(store.dispatch,
- {
- softwareProductId,
- version,
- previousProcess: null,
- process: softwareProductPostRequest
- }
- ).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
+ const softwareProductProcessAfterAdd = VSPProcessStoreFactoryWithType.build(
+ { id: softwareProductProcessFromResponse }
+ );
+ const softwareProductPostRequest = buildFromExistingObject(
+ VSPProcessPostFactoryWithType,
+ softwareProductProcessAfterAdd
+ );
- it('Add Software Products Processes with type', () => {
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processesList',
+ [softwareProductProcessAfterAdd]
+ );
- const store = storeCreator();
- deepFreeze(store.getState());
+ mockRest.addHandler('post', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
+ version.id
+ }/processes`
+ );
+ expect(data).toEqual(softwareProductPostRequest);
+ expect(options).toEqual(undefined);
+ return {
+ returnCode: 'OK',
+ value: softwareProductProcessFromResponse
+ };
+ });
- const softwareProductProcessFromResponse = 'ADDED_ID';
+ return SoftwareProductProcessesActionHelper.saveProcess(
+ store.dispatch,
+ {
+ softwareProductId,
+ version,
+ previousProcess: null,
+ process: softwareProductPostRequest
+ }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
- const softwareProductProcessAfterAdd = VSPProcessStoreFactoryWithType.build({id: softwareProductProcessFromResponse});
- const softwareProductPostRequest = buildFromExistingObject(VSPProcessPostFactoryWithType, softwareProductProcessAfterAdd);
+ it('Add Software Products Processes with uploaded file', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', [softwareProductProcessAfterAdd]);
+ const softwareProductPostRequest = VSPProcessPostFactoryWithType.build();
+ const softwareProductProcessToAdd = VSPProcessPostWithFormDataFactory.build(
+ softwareProductPostRequest
+ );
+ const softwareProductProcessAfterAdd = VSPProcessStoreWithFormDataFactory.build();
- mockRest.addHandler('post', ({data, options, baseUrl}) => {
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processesList',
+ [softwareProductProcessAfterAdd]
+ );
- expect(baseUrl).toEqual(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${version.id}/processes`);
- expect(data).toEqual(softwareProductPostRequest);
- expect(options).toEqual(undefined);
- return {
- returnCode: 'OK',
- value: softwareProductProcessFromResponse
- };
- });
+ mockRest.addHandler('post', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
+ version.id
+ }/processes`
+ );
+ expect(data).toEqual(softwareProductPostRequest);
+ expect(options).toEqual(undefined);
+ return {
+ returnCode: 'OK',
+ value: softwareProductProcessAfterAdd.id
+ };
+ });
- return SoftwareProductProcessesActionHelper.saveProcess(store.dispatch,
- {
- softwareProductId,
- version,
- previousProcess: null,
- process: softwareProductPostRequest
- }
- ).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
+ mockRest.addHandler('post', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
+ version.id
+ }/processes/${softwareProductProcessAfterAdd.id}/upload`
+ );
+ expect(data).toEqual(softwareProductProcessToAdd.formData);
+ expect(options).toEqual(undefined);
+ return { returnCode: 'OK' };
+ });
- it('Add Software Products Processes with uploaded file', () => {
+ return SoftwareProductProcessesActionHelper.saveProcess(
+ store.dispatch,
+ {
+ softwareProductId,
+ version,
+ previousProcess: null,
+ process: softwareProductProcessToAdd
+ }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
- const store = storeCreator();
- deepFreeze(store.getState());
+ //**
+ //** UPDATE
+ //**
+ it('Update Software Products Processes', () => {
+ const softwareProductProcessesList = VSPProcessStoreWithArtifactNameFactory.buildList(
+ 1
+ );
+ deepFreeze(softwareProductProcessesList);
- const softwareProductPostRequest = VSPProcessPostFactoryWithType.build();
- const softwareProductProcessToAdd = VSPProcessPostWithFormDataFactory.build(softwareProductPostRequest);
- const softwareProductProcessAfterAdd = VSPProcessStoreWithFormDataFactory.build();
+ const store = storeCreator({
+ softwareProduct: {
+ softwareProductProcesses: {
+ processesList: softwareProductProcessesList
+ }
+ }
+ });
+ deepFreeze(store.getState());
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', [softwareProductProcessAfterAdd]);
+ const toBeUpdatedProcessId = softwareProductProcessesList[0].id;
+ const previousProcessData = softwareProductProcessesList[0];
+ const processUpdateData = VSPProcessStoreWithArtifactNameFactory.build({
+ ...previousProcessData,
+ name: 'Pr1_UPDATED',
+ description: 'string_UPDATED',
+ type: 'Other'
+ });
- mockRest.addHandler('post', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${version.id}/processes`);
- expect(data).toEqual(softwareProductPostRequest);
- expect(options).toEqual(undefined);
- return {
- returnCode: 'OK',
- value: softwareProductProcessAfterAdd.id
- };
- });
+ deepFreeze(processUpdateData);
- mockRest.addHandler('post', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${version.id}/processes/${softwareProductProcessAfterAdd.id}/upload`);
- expect(data).toEqual(softwareProductProcessToAdd.formData);
- expect(options).toEqual(undefined);
- return {returnCode: 'OK'};
- });
+ const processPutRequest = VSPProcessPostFactory.build({
+ name: 'Pr1_UPDATED',
+ description: 'string_UPDATED',
+ type: 'Other'
+ });
+ deepFreeze(processPutRequest);
- return SoftwareProductProcessesActionHelper.saveProcess(store.dispatch,
- {
- softwareProductId,
- version,
- previousProcess: null,
- process: softwareProductProcessToAdd
- }
- ).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processesList',
+ [processUpdateData]
+ );
- //**
- //** UPDATE
- //**
- it('Update Software Products Processes', () => {
- const softwareProductProcessesList = VSPProcessStoreWithArtifactNameFactory.buildList(1);
- deepFreeze(softwareProductProcessesList);
+ mockRest.addHandler('put', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
+ version.id
+ }/processes/${toBeUpdatedProcessId}`
+ );
+ expect(data).toEqual(processPutRequest);
+ expect(options).toEqual(undefined);
+ return { returnCode: 'OK' };
+ });
- const store = storeCreator({
- softwareProduct: {
- softwareProductProcesses: {
- processesList: softwareProductProcessesList
- }
- }
- });
- deepFreeze(store.getState());
+ return SoftwareProductProcessesActionHelper.saveProcess(
+ store.dispatch,
+ {
+ softwareProductId,
+ version,
+ previousProcess: previousProcessData,
+ process: processUpdateData
+ }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
- const toBeUpdatedProcessId = softwareProductProcessesList[0].id;
- const previousProcessData = softwareProductProcessesList[0];
- const processUpdateData = VSPProcessStoreWithArtifactNameFactory.build(
- {...previousProcessData,
- name: 'Pr1_UPDATED',
- description: 'string_UPDATED',
- type: 'Other'
- }
- );
+ it('Update Software Products Processes and uploaded file', () => {
+ const previousProcessData = VSPProcessStoreWithArtifactNameFactory.build();
+ deepFreeze(previousProcessData);
- deepFreeze(processUpdateData);
+ const store = storeCreator({
+ softwareProduct: {
+ softwareProductProcesses: {
+ processesList: [previousProcessData]
+ }
+ }
+ });
+ deepFreeze(store.getState());
- const processPutRequest = VSPProcessPostFactory.build({
- name: 'Pr1_UPDATED',
- description: 'string_UPDATED',
- type: 'Other'
- });
- deepFreeze(processPutRequest);
+ const newProcessToUpdate = VSPProcessStoreWithFormDataFactory.build({
+ ...previousProcessData,
+ name: 'new name',
+ formData: {
+ name: 'new artifact name'
+ }
+ });
+ deepFreeze(newProcessToUpdate);
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', [processUpdateData]);
+ const newProcessToPutRequest = VSPProcessPostFactory.build({
+ name: newProcessToUpdate.name,
+ description: previousProcessData.description,
+ type: previousProcessData.type
+ });
+ deepFreeze(newProcessToPutRequest);
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processesList',
+ [newProcessToUpdate]
+ );
- mockRest.addHandler('put', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${version.id}/processes/${toBeUpdatedProcessId}`);
- expect(data).toEqual(processPutRequest);
- expect(options).toEqual(undefined);
- return {returnCode: 'OK'};
- });
-
- return SoftwareProductProcessesActionHelper.saveProcess(store.dispatch,
- {
- softwareProductId,
- version,
- previousProcess: previousProcessData,
- process: processUpdateData
- }
- ).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
-
- it('Update Software Products Processes and uploaded file', () => {
- const previousProcessData = VSPProcessStoreWithArtifactNameFactory.build();
- deepFreeze(previousProcessData);
-
- const store = storeCreator({
- softwareProduct: {
- softwareProductProcesses: {
- processesList: [previousProcessData]
- }
- }
- });
- deepFreeze(store.getState());
-
- const newProcessToUpdate = VSPProcessStoreWithFormDataFactory.build({
- ...previousProcessData,
- name: 'new name',
- formData: {
- name: 'new artifact name'
- }
- });
- deepFreeze(newProcessToUpdate);
-
- const newProcessToPutRequest = VSPProcessPostFactory.build({
- name: newProcessToUpdate.name,
- description: previousProcessData.description,
- type: previousProcessData.type
- });
- deepFreeze(newProcessToPutRequest);
-
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', [newProcessToUpdate]);
-
- mockRest.addHandler('put', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${version.id}/processes/${newProcessToUpdate.id}`);
- expect(data).toEqual(newProcessToPutRequest);
- expect(options).toEqual(undefined);
- return {returnCode: 'OK'};
- });
-
- mockRest.addHandler('post', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${version.id}/processes/${newProcessToUpdate.id}/upload`);
- expect(data).toEqual(newProcessToUpdate.formData);
- expect(options).toEqual(undefined);
- return {returnCode: 'OK'};
- });
-
- return SoftwareProductProcessesActionHelper.saveProcess(store.dispatch,
- {
- softwareProductId,
- version,
- previousProcess: previousProcessData,
- process: newProcessToUpdate
- }
- ).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
-
- //**
- //** GET
- //**
- it('Get Software Products Processes List', () => {
- const store = storeCreator();
- deepFreeze(store.getState());
-
- const softwareProductProcessesList = VSPProcessStoreFactory.buildList(2);
-
- deepFreeze(softwareProductProcessesList);
+ mockRest.addHandler('put', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
+ version.id
+ }/processes/${newProcessToUpdate.id}`
+ );
+ expect(data).toEqual(newProcessToPutRequest);
+ expect(options).toEqual(undefined);
+ return { returnCode: 'OK' };
+ });
- deepFreeze(store.getState());
+ mockRest.addHandler('post', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
+ version.id
+ }/processes/${newProcessToUpdate.id}/upload`
+ );
+ expect(data).toEqual(newProcessToUpdate.formData);
+ expect(options).toEqual(undefined);
+ return { returnCode: 'OK' };
+ });
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', softwareProductProcessesList);
+ return SoftwareProductProcessesActionHelper.saveProcess(
+ store.dispatch,
+ {
+ softwareProductId,
+ version,
+ previousProcess: previousProcessData,
+ process: newProcessToUpdate
+ }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
- mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
- expect(baseUrl).toEqual(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${version.id}/processes`);
- expect(data).toEqual(undefined);
- expect(options).toEqual(undefined);
- return {results: softwareProductProcessesList};
- });
+ //**
+ //** GET
+ //**
+ it('Get Software Products Processes List', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
- return SoftwareProductProcessesActionHelper.fetchProcessesList(store.dispatch, {softwareProductId, version}).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
+ const softwareProductProcessesList = VSPProcessStoreFactory.buildList(
+ 2
+ );
- //**
- //** DELETE
- //**
- it('Delete Software Products Processes', () => {
- const softwareProductProcessesList = VSPProcessStoreWithArtifactNameFactory.buildList(1);
- const currentSoftwareProduct = VSPEditorFactory.build();
+ deepFreeze(softwareProductProcessesList);
- deepFreeze(softwareProductProcessesList);
- const store = storeCreator({
- softwareProduct: {
- softwareProductProcesses: {
- processesList: softwareProductProcessesList
- },
- softwareProductEditor: {
- data: currentSoftwareProduct
- }
- }
- });
+ deepFreeze(store.getState());
- const processId = softwareProductProcessesList[0].id;
- const versionId = version.id;
- deepFreeze(store.getState());
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processesList',
+ softwareProductProcessesList
+ );
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', []);
+ mockRest.addHandler('fetch', ({ options, data, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${
+ version.id
+ }/processes`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return { results: softwareProductProcessesList };
+ });
- mockRest.addHandler('destroy', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${versionId}/processes/${processId}`);
- expect(data).toEqual(undefined);
- expect(options).toEqual(undefined);
- return {
- results: {
- returnCode: 'OK'
- }
- };
- });
+ return SoftwareProductProcessesActionHelper.fetchProcessesList(
+ store.dispatch,
+ { softwareProductId, version }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
- return SoftwareProductProcessesActionHelper.deleteProcess(store.dispatch, {
- process: softwareProductProcessesList[0],
- softwareProductId,
- version
- }).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
+ //**
+ //** DELETE
+ //**
+ it('Delete Software Products Processes', () => {
+ const softwareProductProcessesList = VSPProcessStoreWithArtifactNameFactory.buildList(
+ 1
+ );
+ const currentSoftwareProduct = VSPEditorFactory.build();
- it('Validating Software Products Processes Delete confirmation', () => {
- const store = storeCreator();
- deepFreeze(store.getState());
+ deepFreeze(softwareProductProcessesList);
+ const store = storeCreator({
+ softwareProduct: {
+ softwareProductProcesses: {
+ processesList: softwareProductProcessesList
+ },
+ softwareProductEditor: {
+ data: currentSoftwareProduct
+ }
+ }
+ });
- let process = VSPProcessStoreFactory.build();
- deepFreeze(process);
+ const processId = softwareProductProcessesList[0].id;
+ const versionId = version.id;
+ deepFreeze(store.getState());
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processToDelete', process);
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processesList',
+ []
+ );
- return SoftwareProductProcessesActionHelper.openDeleteProcessesConfirm(store.dispatch, {process});
+ mockRest.addHandler('destroy', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/versions/${versionId}/processes/${processId}`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {
+ results: {
+ returnCode: 'OK'
+ }
+ };
+ });
- expect(store.getState()).toEqual(expectedStore);
- });
+ return SoftwareProductProcessesActionHelper.deleteProcess(
+ store.dispatch,
+ {
+ process: softwareProductProcessesList[0],
+ softwareProductId,
+ version
+ }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
- it('Validating Software Products Processes Cancel Delete', () => {
- const store = storeCreator();
- deepFreeze(store.getState());
+ it('Validating Software Products Processes Delete confirmation', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processToDelete', false);
+ let process = VSPProcessStoreFactory.build();
+ deepFreeze(process);
- SoftwareProductProcessesActionHelper.hideDeleteConfirm(store.dispatch);
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processToDelete',
+ process
+ );
- expect(store.getState()).toEqual(expectedStore);
- });
+ return SoftwareProductProcessesActionHelper.openDeleteProcessesConfirm(
+ store.dispatch,
+ { process }
+ );
- //**
- //** CREATE/EDIT
- //**
- it('Validating open Software Products Processes for create', () => {
- const store = storeCreator();
- deepFreeze(store.getState());
+ expect(store.getState()).toEqual(expectedStore);
+ });
- let process = {};
- deepFreeze(process);
+ it('Validating Software Products Processes Cancel Delete', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesEditor.data', process);
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processToDelete',
+ false
+ );
- SoftwareProductProcessesActionHelper.openEditor(store.dispatch);
- expect(store.getState().softwareProduct.softwareProductProcesses.processesEditor.data).toEqual(expectedStore.softwareProduct.softwareProductProcesses.processesEditor.data);
- });
+ SoftwareProductProcessesActionHelper.hideDeleteConfirm(store.dispatch);
- it('Validating close Software Products Processes from editing mode', () => {
- const store = storeCreator();
- deepFreeze(store.getState());
+ expect(store.getState()).toEqual(expectedStore);
+ });
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesEditor', {});
+ //**
+ //** CREATE/EDIT
+ //**
- SoftwareProductProcessesActionHelper.closeEditor(store.dispatch);
- expect(store.getState()).toEqual(expectedStore);
- });
+ it('Validating close Software Products Processes from editing mode', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
- it('Validating open Software Products Processes for editing', () => {
- const store = storeCreator();
- deepFreeze(store.getState());
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processesEditor',
+ {}
+ );
- let process = {name: 'aa', description: 'xx'};
- deepFreeze(process);
+ SoftwareProductProcessesActionHelper.closeEditor(store.dispatch);
+ expect(store.getState()).toEqual(expectedStore);
+ });
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesEditor.data', process);
+ it('Validating open Software Products Processes for editing', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
- SoftwareProductProcessesActionHelper.openEditor(store.dispatch, process);
- expect(store.getState().softwareProduct.softwareProductProcesses.processesEditor.data).toEqual(expectedStore.softwareProduct.softwareProductProcesses.processesEditor.data);
+ let process = { name: 'aa', description: 'xx' };
+ deepFreeze(process);
- });
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processesEditor.data',
+ process
+ );
+ SoftwareProductProcessesActionHelper.openEditor(store.dispatch, {
+ process
+ });
+ expect(
+ store.getState().softwareProduct.softwareProductProcesses
+ .processesEditor.data
+ ).toEqual(
+ expectedStore.softwareProduct.softwareProductProcesses
+ .processesEditor.data
+ );
+ });
});