aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/test/softwareProduct/processes
diff options
context:
space:
mode:
authorAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
committerAviZi <avi.ziv@amdocs.com>2017-06-09 02:39:56 +0300
commit280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch)
tree9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-ui/test/softwareProduct/processes
parentfd3821dad11780d33c5373d74c957c442489945e (diff)
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370 Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-ui/test/softwareProduct/processes')
-rw-r--r--openecomp-ui/test/softwareProduct/processes/SoftwareProductEditor.test.js62
-rw-r--r--openecomp-ui/test/softwareProduct/processes/SoftwareProductProcessesView.test.js75
-rw-r--r--openecomp-ui/test/softwareProduct/processes/test.js338
3 files changed, 285 insertions, 190 deletions
diff --git a/openecomp-ui/test/softwareProduct/processes/SoftwareProductEditor.test.js b/openecomp-ui/test/softwareProduct/processes/SoftwareProductEditor.test.js
new file mode 100644
index 0000000000..b4df9bebd9
--- /dev/null
+++ b/openecomp-ui/test/softwareProduct/processes/SoftwareProductEditor.test.js
@@ -0,0 +1,62 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
+import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesEditor.js';
+import SoftwareProductProcessesEditorView from 'sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesEditorView.jsx';
+import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
+
+describe('Software Product Processes Editor Module Tests', function () {
+
+ it('should mapper exist', () => {
+ expect(mapStateToProps).toBeTruthy();
+ });
+
+ it('should return empty data', () => {
+
+ const currentSoftwareProduct = VSPEditorFactory.build();
+
+ var state = {
+ softwareProduct: {
+ softwareProductEditor: {
+ data: currentSoftwareProduct
+ },
+ softwareProductProcesses:
+ {
+ processesList: [],
+ processesEditor: {data: {}}
+ }
+ }
+ };
+
+ var results = mapStateToProps(state);
+ expect(results.data).toEqual({});
+ expect(results.previousData).toEqual(undefined);
+ });
+
+ it('jsx view test', () => {
+ var view = TestUtils.renderIntoDocument(<SoftwareProductProcessesEditorView
+ isReadOnlyMode={true}
+ data={{}}
+ previousData={{}}
+ onDataChanged={() => {}}
+ onSubmit={() => {}}
+ onClose={() => {}}/>);
+ expect(view).toBeTruthy();
+ });
+
+});
diff --git a/openecomp-ui/test/softwareProduct/processes/SoftwareProductProcessesView.test.js b/openecomp-ui/test/softwareProduct/processes/SoftwareProductProcessesView.test.js
new file mode 100644
index 0000000000..2d7da91cbb
--- /dev/null
+++ b/openecomp-ui/test/softwareProduct/processes/SoftwareProductProcessesView.test.js
@@ -0,0 +1,75 @@
+/*!
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ *
+ * 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
+ *
+ * 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.
+ */
+
+import React from 'react';
+import TestUtils from 'react-addons-test-utils';
+import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcesses.js';
+import SoftwareProductProcessesView from 'sdc-app/onboarding/softwareProduct/processes/SoftwareProductProcessesView.jsx';
+
+import {VSPProcessStoreFactory} from 'test-utils/factories/softwareProduct/SoftwareProductProcessFactories.js';
+import {VSPEditorFactory} from 'test-utils/factories/softwareProduct/SoftwareProductEditorFactories.js';
+import {VSPComponentsVersionControllerFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js';
+
+describe('SoftwareProductProcesses Mapper and View Classes', () => {
+ it ('mapStateToProps mapper exists', () => {
+ expect(mapStateToProps).toBeTruthy();
+ });
+
+ it ('mapStateToProps data test', () => {
+ const currentSoftwareProduct = VSPEditorFactory.build();
+
+ const processesList = VSPProcessStoreFactory.buildList(2);
+
+ var obj = {
+ softwareProduct: {
+ softwareProductEditor: {
+ data: currentSoftwareProduct
+ },
+ softwareProductProcesses:
+ {
+ processesList,
+ processesEditor: {data: {}}
+ }
+ }
+ };
+ var results = mapStateToProps(obj);
+ expect(results.processesList).toBeTruthy();
+ });
+
+ it ('view simple test', () => {
+ const currentSoftwareProduct = VSPEditorFactory.build();
+ const processesList = VSPProcessStoreFactory.buildList(2);
+
+ const versionControllerData = VSPComponentsVersionControllerFactory.build();
+
+
+ var renderer = TestUtils.createRenderer();
+ renderer.render(
+ <SoftwareProductProcessesView
+ processesList={processesList}
+ versionControllerData={versionControllerData}
+ currentSoftwareProduct={currentSoftwareProduct}
+ onAddProcess={() => {}}
+ onEditProcess={() => {}}
+ onDeleteProcess={() => {}}
+ isDisplayEditor={false}
+ isReadOnlyMode={false} />
+ );
+ var renderedOutput = renderer.getRenderOutput();
+ expect(renderedOutput).toBeTruthy();
+
+ });
+});
diff --git a/openecomp-ui/test/softwareProduct/processes/test.js b/openecomp-ui/test/softwareProduct/processes/test.js
index 73f22a7898..43110d2e55 100644
--- a/openecomp-ui/test/softwareProduct/processes/test.js
+++ b/openecomp-ui/test/softwareProduct/processes/test.js
@@ -1,38 +1,44 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
+/*!
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+ *
* 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.
- * ============LICENSE_END=========================================================
+ * 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 {expect} from 'chai';
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 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';
+import ValidationHelper from 'sdc-app/common/helpers/ValidationHelper.js';
const softwareProductId = '123';
+const version = VSPEditorFactory.build().version;
describe('Software Product Processes Module Tests', function () {
let restPrefix = '';
- before(function() {
+ beforeAll(function() {
restPrefix = Configuration.get('restPrefix');
deepFreeze(restPrefix);
});
@@ -45,27 +51,18 @@ describe('Software Product Processes Module Tests', function () {
const store = storeCreator();
deepFreeze(store.getState());
- const softwareProductPostRequest = {
- name: 'Pr1',
- description: 'string'
- };
- const softwareProductProcessToAdd = {
- name: 'Pr1',
- description: 'string'
- };
const softwareProductProcessFromResponse = 'ADDED_ID';
- const softwareProductProcessAfterAdd = {
- ...softwareProductProcessToAdd,
- id: softwareProductProcessFromResponse
- };
+
+ const softwareProductProcessAfterAdd = VSPProcessStoreFactory.build({id: softwareProductProcessFromResponse});
+ const softwareProductPostRequest = buildFromExistingObject(VSPProcessPostFactory, softwareProductProcessAfterAdd);
const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', [softwareProductProcessAfterAdd]);
- mockRest.addHandler('create', ({data, options, baseUrl}) => {
+ mockRest.addHandler('post', ({data, options, baseUrl}) => {
- expect(baseUrl).to.equal(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/processes`);
- expect(data).to.deep.equal(softwareProductPostRequest);
- expect(options).to.equal(undefined);
+ 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
@@ -74,64 +71,88 @@ describe('Software Product Processes Module Tests', function () {
return SoftwareProductProcessesActionHelper.saveProcess(store.dispatch,
{
- softwareProductId: softwareProductId,
+ softwareProductId,
+ version,
previousProcess: null,
- process: softwareProductProcessToAdd
+ process: softwareProductPostRequest
}
).then(() => {
- expect(store.getState()).to.deep.equal(expectedStore);
+ expect(store.getState()).toEqual(expectedStore);
});
});
- it('Add Software Products Processes with uploaded file', () => {
+ it('Add Software Products Processes with type', () => {
const store = storeCreator();
deepFreeze(store.getState());
- const softwareProductPostRequest = {
- name: 'Pr1',
- description: 'string'
- };
- const softwareProductProcessToAdd = {
- name: 'Pr1',
- description: 'string',
- formData: {
- name: 'new artifact name'
- }
- };
const softwareProductProcessFromResponse = 'ADDED_ID';
- const softwareProductProcessAfterAdd = {
- ...softwareProductProcessToAdd,
- id: softwareProductProcessFromResponse
- };
+
+ const softwareProductProcessAfterAdd = VSPProcessStoreFactoryWithType.build({id: softwareProductProcessFromResponse});
+ const softwareProductPostRequest = buildFromExistingObject(VSPProcessPostFactoryWithType, softwareProductProcessAfterAdd);
const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', [softwareProductProcessAfterAdd]);
- mockRest.addHandler('create', ({data, options, baseUrl}) => {
- expect(baseUrl).to.equal(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/processes`);
- expect(data).to.deep.equal(softwareProductPostRequest);
- expect(options).to.equal(undefined);
+ 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
};
});
- mockRest.addHandler('create', ({data, options, baseUrl}) => {
- expect(baseUrl).to.equal(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/processes/${softwareProductProcessAfterAdd.id}/upload`);
- expect(data).to.deep.equal(softwareProductProcessToAdd.formData);
- expect(options).to.equal(undefined);
+ return SoftwareProductProcessesActionHelper.saveProcess(store.dispatch,
+ {
+ softwareProductId,
+ version,
+ previousProcess: null,
+ process: softwareProductPostRequest
+ }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
+
+ it('Add Software Products Processes with uploaded file', () => {
+
+ const store = storeCreator();
+ deepFreeze(store.getState());
+
+ const softwareProductPostRequest = VSPProcessPostFactoryWithType.build();
+ const softwareProductProcessToAdd = VSPProcessPostWithFormDataFactory.build(softwareProductPostRequest);
+ const softwareProductProcessAfterAdd = VSPProcessStoreWithFormDataFactory.build();
+
+ const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', [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: softwareProductProcessAfterAdd.id
+ };
+ });
+
+ 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'};
});
return SoftwareProductProcessesActionHelper.saveProcess(store.dispatch,
{
- softwareProductId: softwareProductId,
+ softwareProductId,
+ version,
previousProcess: null,
process: softwareProductProcessToAdd
}
).then(() => {
- expect(store.getState()).to.deep.equal(expectedStore);
+ expect(store.getState()).toEqual(expectedStore);
});
});
@@ -139,14 +160,7 @@ describe('Software Product Processes Module Tests', function () {
//** UPDATE
//**
it('Update Software Products Processes', () => {
- const softwareProductProcessesList = [
- {
- name: 'Pr1',
- description: 'string',
- id: 'EBADF561B7FA4A788075E1840D0B5971',
- artifactName: 'artifact'
- }
- ];
+ const softwareProductProcessesList = VSPProcessStoreWithArtifactNameFactory.buildList(1);
deepFreeze(softwareProductProcessesList);
const store = storeCreator({
@@ -160,47 +174,47 @@ describe('Software Product Processes Module Tests', function () {
const toBeUpdatedProcessId = softwareProductProcessesList[0].id;
const previousProcessData = softwareProductProcessesList[0];
- const processUpdateData = {
- ...softwareProductProcessesList[0],
- name: 'Pr1_UPDATED',
- description: 'string_UPDATED'
- };
+ const processUpdateData = VSPProcessStoreWithArtifactNameFactory.build(
+ {...previousProcessData,
+ name: 'Pr1_UPDATED',
+ description: 'string_UPDATED',
+ type: 'Other'
+ }
+ );
+
deepFreeze(processUpdateData);
- const processPutRequest = {
+ const processPutRequest = VSPProcessPostFactory.build({
name: 'Pr1_UPDATED',
- description: 'string_UPDATED'
- };
+ description: 'string_UPDATED',
+ type: 'Other'
+ });
deepFreeze(processPutRequest);
const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', [processUpdateData]);
- mockRest.addHandler('save', ({data, options, baseUrl}) => {
- expect(baseUrl).to.equal(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/processes/${toBeUpdatedProcessId}`);
- expect(data).to.deep.equal(processPutRequest);
- expect(options).to.equal(undefined);
+ 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: softwareProductId,
+ softwareProductId,
+ version,
previousProcess: previousProcessData,
process: processUpdateData
}
).then(() => {
- expect(store.getState()).to.deep.equal(expectedStore);
+ expect(store.getState()).toEqual(expectedStore);
});
});
it('Update Software Products Processes and uploaded file', () => {
- const previousProcessData = {
- id: 'EBADF561B7FA4A788075E1840D0B5971',
- name: 'p1',
- description: 'string',
- artifactName: 'artifact'
- };
+ const previousProcessData = VSPProcessStoreWithArtifactNameFactory.build();
deepFreeze(previousProcessData);
const store = storeCreator({
@@ -212,45 +226,47 @@ describe('Software Product Processes Module Tests', function () {
});
deepFreeze(store.getState());
- const newProcessToUpdate = {
+ const newProcessToUpdate = VSPProcessStoreWithFormDataFactory.build({
...previousProcessData,
name: 'new name',
formData: {
name: 'new artifact name'
}
- };
+ });
deepFreeze(newProcessToUpdate);
- const newProcessToPutRequest = {
+ const newProcessToPutRequest = VSPProcessPostFactory.build({
name: newProcessToUpdate.name,
- description: previousProcessData.description
- };
+ description: previousProcessData.description,
+ type: previousProcessData.type
+ });
deepFreeze(newProcessToPutRequest);
const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', [newProcessToUpdate]);
- mockRest.addHandler('save', ({data, options, baseUrl}) => {
- expect(baseUrl).to.equal(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/processes/${previousProcessData.id}`);
- expect(data).to.deep.equal(newProcessToPutRequest);
- expect(options).to.equal(undefined);
+ 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('create', ({data, options, baseUrl}) => {
- expect(baseUrl).to.equal(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/processes/${previousProcessData.id}/upload`);
- expect(data).to.deep.equal(newProcessToUpdate.formData);
- expect(options).to.equal(undefined);
+ 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: softwareProductId,
+ softwareProductId,
+ version,
previousProcess: previousProcessData,
process: newProcessToUpdate
}
).then(() => {
- expect(store.getState()).to.deep.equal(expectedStore);
+ expect(store.getState()).toEqual(expectedStore);
});
});
@@ -261,20 +277,7 @@ describe('Software Product Processes Module Tests', function () {
const store = storeCreator();
deepFreeze(store.getState());
- const softwareProductProcessesList = [
- {
- name: 'Pr1',
- description: 'hjhj',
- id: 'EBADF561B7FA4A788075E1840D0B5971',
- artifactName: 'artifact'
- },
- {
- name: 'Pr1',
- description: 'hjhj',
- id: '2F47447D22DB4C53B020CA1E66201EF2',
- artifactName: 'artifact'
- }
- ];
+ const softwareProductProcessesList = VSPProcessStoreFactory.buildList(2);
deepFreeze(softwareProductProcessesList);
@@ -283,14 +286,14 @@ describe('Software Product Processes Module Tests', function () {
const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', softwareProductProcessesList);
mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
- expect(baseUrl).to.equal(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/processes`);
- expect(data).to.deep.equal(undefined);
- expect(options).to.equal(undefined);
+ 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};
});
- return SoftwareProductProcessesActionHelper.fetchProcessesList(store.dispatch, {softwareProductId}).then(() => {
- expect(store.getState()).to.deep.equal(expectedStore);
+ return SoftwareProductProcessesActionHelper.fetchProcessesList(store.dispatch, {softwareProductId, version}).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
});
});
@@ -298,33 +301,32 @@ describe('Software Product Processes Module Tests', function () {
//** DELETE
//**
it('Delete Software Products Processes', () => {
- const softwareProductProcessesList = [
- {
- name: 'Pr1',
- description: 'hjhj',
- id: 'EBADF561B7FA4A788075E1840D0B5971',
- artifactName: 'artifact'
- }
- ];
+ const softwareProductProcessesList = VSPProcessStoreWithArtifactNameFactory.buildList(1);
+ const currentSoftwareProduct = VSPEditorFactory.build();
deepFreeze(softwareProductProcessesList);
const store = storeCreator({
softwareProduct: {
softwareProductProcesses: {
processesList: softwareProductProcessesList
+ },
+ softwareProductEditor: {
+ data: currentSoftwareProduct
}
}
});
- const processId = 'EBADF561B7FA4A788075E1840D0B5971';
+ const processId = softwareProductProcessesList[0].id;
+ const version = store.getState().softwareProduct.softwareProductEditor.data.version;
+ const versionId = version.id;
deepFreeze(store.getState());
const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', []);
mockRest.addHandler('destroy', ({data, options, baseUrl}) => {
- expect(baseUrl).to.equal(`${restPrefix}/v1.0/vendor-software-products/${softwareProductId}/processes/${processId}`);
- expect(data).to.equal(undefined);
- expect(options).to.equal(undefined);
+ 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'
@@ -334,9 +336,10 @@ describe('Software Product Processes Module Tests', function () {
return SoftwareProductProcessesActionHelper.deleteProcess(store.dispatch, {
process: softwareProductProcessesList[0],
- softwareProductId
+ softwareProductId,
+ version
}).then(() => {
- expect(store.getState()).to.deep.equal(expectedStore);
+ expect(store.getState()).toEqual(expectedStore);
});
});
@@ -344,10 +347,7 @@ describe('Software Product Processes Module Tests', function () {
const store = storeCreator();
deepFreeze(store.getState());
- let process = {
- id: 'p_id',
- name: 'p_name'
- };
+ let process = VSPProcessStoreFactory.build();
deepFreeze(process);
const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processToDelete', process);
@@ -355,7 +355,7 @@ describe('Software Product Processes Module Tests', function () {
SoftwareProductProcessesActionHelper.openDeleteProcessesConfirm(store.dispatch, {process});
setTimeout(function(){
- expect(store.getState()).to.deep.equal(expectedStore);
+ expect(store.getState()).toEqual(expectedStore);
done();
}, 100);
});
@@ -369,7 +369,7 @@ describe('Software Product Processes Module Tests', function () {
SoftwareProductProcessesActionHelper.hideDeleteConfirm(store.dispatch);
setTimeout(function(){
- expect(store.getState()).to.deep.equal(expectedStore);
+ expect(store.getState()).toEqual(expectedStore);
done();
}, 100);
});
@@ -377,7 +377,7 @@ describe('Software Product Processes Module Tests', function () {
//**
//** CREATE/EDIT
//**
- it('Validating open Software Products Processes for create', done => {
+ it('Validating open Software Products Processes for create', () => {
const store = storeCreator();
deepFreeze(store.getState());
@@ -387,28 +387,20 @@ describe('Software Product Processes Module Tests', function () {
const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesEditor.data', process);
SoftwareProductProcessesActionHelper.openEditor(store.dispatch);
-
- setTimeout(function(){
- expect(store.getState()).to.deep.equal(expectedStore);
- done();
- }, 100);
+ expect(store.getState().softwareProduct.softwareProductProcesses.processesEditor.data).toEqual(expectedStore.softwareProduct.softwareProductProcesses.processesEditor.data);
});
- it('Validating close Software Products Processes from editing mode', done => {
+ it('Validating close Software Products Processes from editing mode', () => {
const store = storeCreator();
deepFreeze(store.getState());
const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesEditor', {});
SoftwareProductProcessesActionHelper.closeEditor(store.dispatch);
-
- setTimeout(function(){
- expect(store.getState()).to.deep.equal(expectedStore);
- done();
- }, 100);
+ expect(store.getState()).toEqual(expectedStore);
});
- it('Validating open Software Products Processes for editing', done => {
+ it('Validating open Software Products Processes for editing', () => {
const store = storeCreator();
deepFreeze(store.getState());
@@ -418,42 +410,8 @@ describe('Software Product Processes Module Tests', function () {
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);
- setTimeout(function(){
- expect(store.getState()).to.deep.equal(expectedStore);
- done();
- }, 100);
});
- it('Validating Software Products Processes dataChanged event', done => {
- let process = {name: 'aa', description: 'xx'};
- deepFreeze(process);
-
- const store = storeCreator({
- softwareProduct: {
- softwareProductProcesses: {
- processesEditor: {
- data: process
- }
- }
- }
- });
- deepFreeze(store.getState());
-
- let deltaData = {name: 'bb'};
- deepFreeze(deltaData);
-
- let expectedProcess = {name: 'bb', description: 'xx'};
- deepFreeze(expectedProcess);
-
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesEditor.data', expectedProcess);
-
- SoftwareProductProcessesActionHelper.processEditorDataChanged(store.dispatch, {deltaData});
-
- setTimeout(function(){
- expect(store.getState()).to.deep.equal(expectedStore);
- done();
- }, 100);
- });
});
-