aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/test
diff options
context:
space:
mode:
authorEinav Weiss Keidar <einavw@amdocs.com>2018-08-13 16:19:46 +0300
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-02-11 13:50:22 +0000
commit1801b24389baa8e3f7298ff2c41e2512b19c1290 (patch)
treed3d2a15f53aa28698280d609548298d177f9280d /openecomp-ui/test
parentaf8e36eb7f43803bd9cf40e9b46a0c0c8f47c781 (diff)
react 16 upgrade
Issue-ID: SDC-1762 Change-Id: I7701f12fc63bb09f8c985c7c893b984701dcbfab Signed-off-by: Einav Keidar <einavw@amdocs.com>
Diffstat (limited to 'openecomp-ui/test')
-rw-r--r--openecomp-ui/test/activity-log/ActivityLog.test.js185
-rw-r--r--openecomp-ui/test/flows/test.js364
-rw-r--r--openecomp-ui/test/licenseModel/featureGroups/LicenseModelFeatureGroupListEditor.test.js124
-rw-r--r--openecomp-ui/test/licenseModel/test.js3
-rw-r--r--openecomp-ui/test/nfvo-components/editor/TabulatedEditor.test.js76
-rw-r--r--openecomp-ui/test/onboard/filter/filterView.test.js2
-rw-r--r--openecomp-ui/test/softwareProduct/processes/test.js877
-rw-r--r--openecomp-ui/test/softwareProduct/test.js3
-rw-r--r--openecomp-ui/test/utils/errorResponseHandler.test.js237
9 files changed, 1035 insertions, 836 deletions
diff --git a/openecomp-ui/test/activity-log/ActivityLog.test.js b/openecomp-ui/test/activity-log/ActivityLog.test.js
index d2c135eb79..a397197773 100644
--- a/openecomp-ui/test/activity-log/ActivityLog.test.js
+++ b/openecomp-ui/test/activity-log/ActivityLog.test.js
@@ -1,99 +1,142 @@
-/*!
- * 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 React from 'react';
-import {mount} from 'enzyme';
-import {cloneAndSet} from 'test-utils/Util.js';
-import ActivityLogView, {ActivityListItem} from 'sdc-app/common/activity-log/ActivityLogView.jsx';
+import { mount } from 'enzyme';
+import { cloneAndSet } from 'test-utils/Util.js';
+import ActivityLogView, {
+ ActivityListItem
+} from 'sdc-app/common/activity-log/ActivityLogView.jsx';
import ListEditorView from 'nfvo-components/listEditor/ListEditorView.jsx';
import ActivityLogActionHelper from 'sdc-app/common/activity-log/ActivityLogActionHelper.js';
-import {mapStateToProps} from 'sdc-app/common/activity-log/ActivityLog.js';
-import {storeCreator} from 'sdc-app/AppStore.js';
+import { mapStateToProps } from 'sdc-app/common/activity-log/ActivityLog.js';
+import { storeCreator } from 'sdc-app/AppStore.js';
import mockRest from 'test-utils/MockRest.js';
-import {ActivityLogStoreFactory} from 'test-utils/factories/activity-log/ActivityLogFactories.js';
+import { ActivityLogStoreFactory } from 'test-utils/factories/activity-log/ActivityLogFactories.js';
import VersionFactory from 'test-utils/factories/common/VersionFactory.js';
-import {UserFactory} from 'test-utils/factories/users/UsersFactories.js';
+import { UserFactory } from 'test-utils/factories/users/UsersFactories.js';
-import {actionTypes as userActionTypes} from 'sdc-app/onboarding/users/UsersConstants.js';
+import { actionTypes as userActionTypes } from 'sdc-app/onboarding/users/UsersConstants.js';
-describe('Activity Log Module Tests', function () {
- const LICENSE_MODEL_ID = '555';
- const version = VersionFactory.build();
- const usersList = UserFactory.buildList(3);
+describe('Activity Log Module Tests', function() {
+ const LICENSE_MODEL_ID = '555';
+ const version = VersionFactory.build();
+ const usersList = UserFactory.buildList(3);
- it('mapStateToProps mapper exists', () => {
- expect(mapStateToProps).toBeTruthy();
- });
+ it('mapStateToProps mapper exists', () => {
+ expect(mapStateToProps).toBeTruthy();
+ });
- it('Loads Activity Log and renders into jsx', () => {
- const store = storeCreator();
- const dispatch = store.dispatch;
- dispatch({
- type: userActionTypes.USERS_LIST_LOADED,
- usersList
- });
- let ActivityLogList = ActivityLogStoreFactory.buildList(1, {user: usersList[0].userId});
- const expectedStore = cloneAndSet(store.getState(), 'licenseModel.activityLog', ActivityLogList);
+ it('Loads Activity Log and renders into jsx', () => {
+ const store = storeCreator();
+ const dispatch = store.dispatch;
+ dispatch({
+ type: userActionTypes.USERS_LIST_LOADED,
+ usersList
+ });
+ let ActivityLogList = ActivityLogStoreFactory.buildList(1, {
+ user: usersList[0].userId
+ });
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'licenseModel.activityLog',
+ ActivityLogList
+ );
- mockRest.addHandler('fetch', ({data, options, baseUrl}) => {
- expect(baseUrl).toEqual(`/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${version.id}/activity-logs`);
- expect(data).toEqual(undefined);
- expect(options).toEqual(undefined);
- return {results: ActivityLogList};
- });
+ mockRest.addHandler('fetch', ({ data, options, baseUrl }) => {
+ expect(baseUrl).toEqual(
+ `/onboarding-api/v1.0/items/${LICENSE_MODEL_ID}/versions/${
+ version.id
+ }/activity-logs`
+ );
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return { results: ActivityLogList };
+ });
- return ActivityLogActionHelper.fetchActivityLog(dispatch, {itemId: LICENSE_MODEL_ID, versionId: version.id}).then(() => {
- const state = store.getState();
- expect(state).toEqual(expectedStore);
- const props = mapStateToProps(state);
- expect(props.activities).toEqual(ActivityLogList.map(activity =>
- ({...activity, user: {id: activity.user, name: usersList.find(userObject => userObject.userId === activity.user).fullName}})
- ));
- const wrapper = mount(<ActivityLogView {...props}/>);
- expect(wrapper).toBeTruthy();
- });
- });
+ return ActivityLogActionHelper.fetchActivityLog(dispatch, {
+ itemId: LICENSE_MODEL_ID,
+ versionId: version.id
+ }).then(() => {
+ const state = store.getState();
+ expect(state).toEqual(expectedStore);
+ const props = mapStateToProps(state);
+ expect(props.activities).toEqual(
+ ActivityLogList.map(activity => ({
+ ...activity,
+ user: {
+ id: activity.user,
+ name: usersList.find(
+ userObject => userObject.userId === activity.user
+ ).fullName
+ }
+ }))
+ );
+ const wrapper = mount(<ActivityLogView {...props} />);
+ expect(wrapper).toBeTruthy();
+ });
+ });
- it('Tests Activity Log filter and sorting abilities', () => {
- const firstDate = new Date();
- const secondDate = new Date();
- secondDate.setDate(firstDate.getDate() - 1);
+ it('Tests Activity Log filter and sorting abilities', () => {
+ const firstDate = new Date();
+ const secondDate = new Date();
+ secondDate.setDate(firstDate.getDate() - 1);
- const firstTimestamp = firstDate.getTime();
- const secondTimestamp = secondDate.getTime();
+ const firstTimestamp = firstDate.getTime();
+ const secondTimestamp = secondDate.getTime();
- let firstActivity = ActivityLogStoreFactory.build({user: usersList[0].userId, timestamp: firstTimestamp});
- let secondActivity = ActivityLogStoreFactory.build({user: usersList[1].userId, timestamp: secondTimestamp, status: {success: false, message: 'error'}});
- let props = mapStateToProps({users: {usersList}, licenseModel: {activityLog: [firstActivity, secondActivity]}});
- const wrapper = mount(<ActivityLogView {...props}/>);
- expect(wrapper.find(ActivityListItem).length).toEqual(3); // Includes Header component
+ let firstActivity = ActivityLogStoreFactory.build({
+ user: usersList[0].userId,
+ timestamp: firstTimestamp
+ });
+ let secondActivity = ActivityLogStoreFactory.build({
+ user: usersList[1].userId,
+ timestamp: secondTimestamp,
+ status: { success: false, message: 'error' }
+ });
+ let props = mapStateToProps({
+ users: { usersList },
+ licenseModel: { activityLog: [firstActivity, secondActivity] }
+ });
+ const wrapper = mount(<ActivityLogView {...props} />);
+ expect(wrapper.find(ActivityListItem).length).toEqual(3); // Includes Header component
- const firstInstance = wrapper.find(ActivityListItem).at(1);
- const firstInstanceProps = firstInstance.props();
- expect(firstInstanceProps.activity.timestamp).toEqual(secondTimestamp); // Default sorting is descending
+ const firstInstance = wrapper.find(ActivityListItem).at(1);
+ const firstInstanceProps = firstInstance.props();
+ expect(firstInstanceProps.activity.timestamp).toEqual(secondTimestamp); // Default sorting is descending
- const header = wrapper.find(ActivityListItem).at(0);
- header.props().onSort();
- const newFirstInstance = wrapper.find(ActivityListItem).at(1);
- const newFirstInstanceProps = newFirstInstance.props();
- expect(newFirstInstanceProps.activity.timestamp).toEqual(firstTimestamp);
+ const header = wrapper.find(ActivityListItem).at(0);
- const listEditor = wrapper.find(ListEditorView);
- listEditor.props().onFilter(usersList[1].fullName);
- expect(wrapper.find(ActivityListItem).length).toEqual(2);
- expect(wrapper.find(ActivityListItem).at(1).props().activity.user.name).toEqual(usersList[1].fullName);
- });
+ header.props().onSort();
+ wrapper.update();
+ const newFirstInstance = wrapper.find(ActivityListItem).at(1);
+ const newFirstInstanceProps = newFirstInstance.props();
+ expect(newFirstInstanceProps.activity.timestamp).toEqual(
+ firstTimestamp
+ );
+
+ const listEditor = wrapper.find(ListEditorView);
+ listEditor.props().onFilter(usersList[1].fullName);
+ wrapper.update();
+ expect(wrapper.find(ActivityListItem).length).toEqual(2);
+ expect(
+ wrapper
+ .find(ActivityListItem)
+ .at(1)
+ .props().activity.user.name
+ ).toEqual(usersList[1].fullName);
+ });
});
diff --git a/openecomp-ui/test/flows/test.js b/openecomp-ui/test/flows/test.js
index 6e02e54816..621b6a1447 100644
--- a/openecomp-ui/test/flows/test.js
+++ b/openecomp-ui/test/flows/test.js
@@ -1,187 +1,223 @@
-/*!
- * 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 store from 'sdc-app/AppStore.js';
import FlowsActions from 'sdc-app/flows/FlowsActions.js';
-import {enums} from 'sdc-app/flows/FlowsConstants.js';
+import { enums } from 'sdc-app/flows/FlowsConstants.js';
import {
- FlowCreateFactory,
- FlowPostRequestFactory,
- FlowPostResponseFactory,
- FlowFetchRequestFactory,
- FlowFetchResponseFactory,
- FlowDeleteRequestFactory,
- FlowUpdateRequestFactory } from 'test-utils/factories/flows/FlowsFactories.js';
+ FlowCreateFactory,
+ FlowPostRequestFactory,
+ FlowPostResponseFactory,
+ FlowFetchRequestFactory,
+ FlowFetchResponseFactory,
+ FlowDeleteRequestFactory,
+ FlowUpdateRequestFactory
+} from 'test-utils/factories/flows/FlowsFactories.js';
-import {buildFromExistingObject} from 'test-utils/Util.js';
+import { buildFromExistingObject } from 'test-utils/Util.js';
const NEW_FLOW = true;
-let assertFlowDataAfterCreateFetchAndUpdate = (data) => {
- let {flowList, serviceID, diagramType} = store.getState().flows;
- expect(serviceID).toBe(data.serviceID);
- expect(diagramType).toBe(data.artifactType);
- let uniqueId = data.uniqueId || `${data.serviceID}.${data.artifactName}`;
- let index = flowList.findIndex(flow => flow.uniqueId === uniqueId);
- expect(index).not.toBe(-1);
+let assertFlowDataAfterCreateFetchAndUpdate = data => {
+ let { flowList, serviceID, diagramType } = store.getState().flows;
+ expect(serviceID).toBe(data.serviceID);
+ expect(diagramType).toBe(data.artifactType);
+ let uniqueId = data.uniqueId || `${data.serviceID}.${data.artifactName}`;
+ let index = flowList.findIndex(flow => flow.uniqueId === uniqueId);
+ expect(index).not.toBe(-1);
};
-describe('Workflows and Management Flows Module Tests:', function () {
-
-
- it('empty artifact should open flow creation modal', () => {
-
- const artifacts = {};
-
- deepFreeze(store.getState());
- deepFreeze(artifacts);
- FlowsActions.fetchFlowArtifacts(store.dispatch, {
- artifacts,
- diagramType: enums.WORKFLOW,
- participants: [],
- serviceID: '1234'
- });
- let state = store.getState();
- expect(state.flows.isDisplayModal).toBe(true);
- expect(state.flows.isModalInEditMode).toBe(false);
- });
-
- it('Close flow details editor modal', () => {
- deepFreeze(store.getState());
- FlowsActions.closeFlowDetailsEditor(store.dispatch);
- let state = store.getState();
- expect(state.flows.isDisplayModal).toBe(false);
- expect(state.flows.isModalInEditMode).toBe(false);
- });
-
- it('Get Flows List from loaded artifact', () => {
-
- deepFreeze(store.getState());
-
- const artifacts = {
- 'test1': FlowPostResponseFactory.build({artifactName: 'test1'}),
- 'kukuriku': FlowPostResponseFactory.build({
- 'artifactType': 'PUPPET',
- 'artifactName': 'kukuriku',
- }),
- 'test3': FlowPostResponseFactory.build({artifactName: 'test3'})
- };
-
- const artifactsArray = Object.keys(artifacts).map(artifact => artifact);
-
- deepFreeze(artifacts);
-
- deepFreeze(store.getState());
-
- let actionData = {
- artifacts,
- diagramType: enums.WORKFLOW,
- participants: [],
- serviceID: '1234'
- };
- FlowsActions.fetchFlowArtifacts(store.dispatch, actionData);
-
- let state = store.getState();
- expect(state.flows.isDisplayModal).toBe(false);
- expect(state.flows.isModalInEditMode).toBe(false);
- expect(state.flows.flowList.length).toEqual(artifactsArray.length);
- expect(state.flows.flowParticipants).toEqual(actionData.participants);
- expect(state.flows.serviceID).toBe(actionData.serviceID);
- expect(state.flows.diagramType).toBe(actionData.diagramType);
-
- });
-
-
- it('Add New Flow', () => {
-
- deepFreeze(store.getState());
-
- const flowCreateData = FlowCreateFactory.build();
- let expectedDataToBeSentInTheRequest = buildFromExistingObject(FlowPostRequestFactory, flowCreateData);
-
- mockRest.addHandler('post', ({data, baseUrl, options}) => {
- expect(baseUrl).toBe(`/sdc1/feProxy/rest/v1/catalog/services/${flowCreateData.serviceID}/artifacts/`);
- expect(data.artifactLabel).toBe(expectedDataToBeSentInTheRequest.artifactLabel);
- expect(data.artifactName).toBe(expectedDataToBeSentInTheRequest.artifactName);
- expect(data.artifactType).toBe(expectedDataToBeSentInTheRequest.artifactType);
- expect(data.description).toBe(expectedDataToBeSentInTheRequest.description);
- expect(data.payloadData).toBe(expectedDataToBeSentInTheRequest.payloadData);
- expect(options.md5).toBe(true);
- return buildFromExistingObject(FlowPostResponseFactory, expectedDataToBeSentInTheRequest);
- });
-
- return FlowsActions.createOrUpdateFlow(store.dispatch, {flow: flowCreateData}, NEW_FLOW).then(() => {
- assertFlowDataAfterCreateFetchAndUpdate(flowCreateData);
- });
-
-
- });
-
- it('Fetch Flow', () => {
-
- deepFreeze(store.getState());
-
- const flowFetchData = FlowFetchRequestFactory.build();
-
- mockRest.addHandler('fetch', ({baseUrl}) => {
- //sdc1/feProxy/rest/v1/catalog/services/338d75f0-aec8-4eb4-89c9-8733fcd9bf3b/artifacts/338d75f0-aec8-4eb4-89c9-8733fcd9bf3b.zizizi
- expect(baseUrl).toBe(`/sdc1/feProxy/rest/v1/catalog/services/${flowFetchData.serviceID}/artifacts/${flowFetchData.uniqueId}`);
- return buildFromExistingObject(FlowFetchResponseFactory, flowFetchData);
- });
-
- return FlowsActions.fetchArtifact(store.dispatch, {flow: flowFetchData}).then(() => {
- assertFlowDataAfterCreateFetchAndUpdate(flowFetchData);
- });
- });
-
- it('Update Existing Flow', () => {
-
- deepFreeze(store.getState());
- const flowUpdateData = FlowUpdateRequestFactory.build();
-
- mockRest.addHandler('post', ({baseUrl}) => {
- expect(baseUrl).toBe(`/sdc1/feProxy/rest/v1/catalog/services/${flowUpdateData.serviceID}/artifacts/${flowUpdateData.uniqueId}`);
-
- return buildFromExistingObject(FlowPostResponseFactory, flowUpdateData);
- });
-
- return FlowsActions.createOrUpdateFlow(store.dispatch, {flow: flowUpdateData}, !NEW_FLOW).then(() => {
- assertFlowDataAfterCreateFetchAndUpdate(flowUpdateData);
- });
-
- });
-
- it('Delete Flow', () => {
-
- deepFreeze(store.getState());
-
- const flowDeleteData = FlowDeleteRequestFactory.build();
-
- mockRest.addHandler('destroy', ({baseUrl}) => {
- expect(baseUrl).toBe(`/sdc1/feProxy/rest/v1/catalog/services/${flowDeleteData.serviceID}/artifacts/${flowDeleteData.uniqueId}`);
- return {};
- });
-
- return FlowsActions.deleteFlow(store.dispatch, {flow: flowDeleteData}).then(() => {
- let {flowList} = store.getState().flows;
- let index = flowList.findIndex(flow => flow.uniqueId === flowDeleteData.uniqueId);
- expect(index).toBe(-1);
- });
- });
+describe('Workflows and Management Flows Module Tests:', function() {
+ it('empty artifact should open flow creation modal', () => {
+ const artifacts = {};
+
+ deepFreeze(store.getState());
+ deepFreeze(artifacts);
+ FlowsActions.fetchFlowArtifacts(store.dispatch, {
+ artifacts,
+ diagramType: enums.WORKFLOW,
+ participants: [],
+ serviceID: '1234'
+ });
+ let state = store.getState();
+ expect(state.modal).toBeDefined();
+ });
+
+ it('Close flow details editor modal', () => {
+ deepFreeze(store.getState());
+ FlowsActions.closeEditCreateWFModal(store.dispatch);
+ let state = store.getState();
+ expect(state.modal).toBeFalsy();
+ });
+
+ it('Get Flows List from loaded artifact', () => {
+ deepFreeze(store.getState());
+
+ const artifacts = {
+ test1: FlowPostResponseFactory.build({ artifactName: 'test1' }),
+ kukuriku: FlowPostResponseFactory.build({
+ artifactType: 'PUPPET',
+ artifactName: 'kukuriku'
+ }),
+ test3: FlowPostResponseFactory.build({ artifactName: 'test3' })
+ };
+
+ const artifactsArray = Object.keys(artifacts).map(artifact => artifact);
+
+ deepFreeze(artifacts);
+
+ deepFreeze(store.getState());
+
+ let actionData = {
+ artifacts,
+ diagramType: enums.WORKFLOW,
+ participants: [],
+ serviceID: '1234'
+ };
+ FlowsActions.fetchFlowArtifacts(store.dispatch, actionData);
+
+ let state = store.getState();
+ expect(state.flows.flowList.length).toEqual(artifactsArray.length);
+ expect(state.flows.flowParticipants).toEqual(actionData.participants);
+ expect(state.flows.serviceID).toBe(actionData.serviceID);
+ expect(state.flows.diagramType).toBe(actionData.diagramType);
+ });
+
+ it('Add New Flow', () => {
+ deepFreeze(store.getState());
+
+ const flowCreateData = FlowCreateFactory.build();
+ let expectedDataToBeSentInTheRequest = buildFromExistingObject(
+ FlowPostRequestFactory,
+ flowCreateData
+ );
+
+ mockRest.addHandler('post', ({ data, baseUrl, options }) => {
+ expect(baseUrl).toBe(
+ `/sdc1/feProxy/rest/v1/catalog/services/${
+ flowCreateData.serviceID
+ }/artifacts/`
+ );
+ expect(data.artifactLabel).toBe(
+ expectedDataToBeSentInTheRequest.artifactLabel
+ );
+ expect(data.artifactName).toBe(
+ expectedDataToBeSentInTheRequest.artifactName
+ );
+ expect(data.artifactType).toBe(
+ expectedDataToBeSentInTheRequest.artifactType
+ );
+ expect(data.description).toBe(
+ expectedDataToBeSentInTheRequest.description
+ );
+ expect(data.payloadData).toBe(
+ expectedDataToBeSentInTheRequest.payloadData
+ );
+ expect(options.md5).toBe(true);
+ return buildFromExistingObject(
+ FlowPostResponseFactory,
+ expectedDataToBeSentInTheRequest
+ );
+ });
+
+ return FlowsActions.createOrUpdateFlow(
+ store.dispatch,
+ { flow: flowCreateData },
+ NEW_FLOW
+ ).then(() => {
+ assertFlowDataAfterCreateFetchAndUpdate(flowCreateData);
+ });
+ });
+
+ it('Fetch Flow', () => {
+ deepFreeze(store.getState());
+
+ const flowFetchData = FlowFetchRequestFactory.build();
+
+ mockRest.addHandler('fetch', ({ baseUrl }) => {
+ //sdc1/feProxy/rest/v1/catalog/services/338d75f0-aec8-4eb4-89c9-8733fcd9bf3b/artifacts/338d75f0-aec8-4eb4-89c9-8733fcd9bf3b.zizizi
+ expect(baseUrl).toBe(
+ `/sdc1/feProxy/rest/v1/catalog/services/${
+ flowFetchData.serviceID
+ }/artifacts/${flowFetchData.uniqueId}`
+ );
+ return buildFromExistingObject(
+ FlowFetchResponseFactory,
+ flowFetchData
+ );
+ });
+
+ return FlowsActions.fetchArtifact(store.dispatch, {
+ flow: flowFetchData
+ }).then(() => {
+ assertFlowDataAfterCreateFetchAndUpdate(flowFetchData);
+ });
+ });
+
+ it('Update Existing Flow', () => {
+ deepFreeze(store.getState());
+ const flowUpdateData = FlowUpdateRequestFactory.build();
+
+ mockRest.addHandler('post', ({ baseUrl }) => {
+ expect(baseUrl).toBe(
+ `/sdc1/feProxy/rest/v1/catalog/services/${
+ flowUpdateData.serviceID
+ }/artifacts/${flowUpdateData.uniqueId}`
+ );
+
+ return buildFromExistingObject(
+ FlowPostResponseFactory,
+ flowUpdateData
+ );
+ });
+
+ return FlowsActions.createOrUpdateFlow(
+ store.dispatch,
+ { flow: flowUpdateData },
+ !NEW_FLOW
+ ).then(() => {
+ assertFlowDataAfterCreateFetchAndUpdate(flowUpdateData);
+ });
+ });
+
+ it('Delete Flow', () => {
+ deepFreeze(store.getState());
+
+ const flowDeleteData = FlowDeleteRequestFactory.build();
+
+ mockRest.addHandler('destroy', ({ baseUrl }) => {
+ expect(baseUrl).toBe(
+ `/sdc1/feProxy/rest/v1/catalog/services/${
+ flowDeleteData.serviceID
+ }/artifacts/${flowDeleteData.uniqueId}`
+ );
+ return {};
+ });
+
+ return FlowsActions.deleteFlow(store.dispatch, {
+ flow: flowDeleteData
+ }).then(() => {
+ let { flowList } = store.getState().flows;
+ let index = flowList.findIndex(
+ flow => flow.uniqueId === flowDeleteData.uniqueId
+ );
+ expect(index).toBe(-1);
+ });
+ });
});
diff --git a/openecomp-ui/test/licenseModel/featureGroups/LicenseModelFeatureGroupListEditor.test.js b/openecomp-ui/test/licenseModel/featureGroups/LicenseModelFeatureGroupListEditor.test.js
index 565b8a436b..4957e3bbaf 100644
--- a/openecomp-ui/test/licenseModel/featureGroups/LicenseModelFeatureGroupListEditor.test.js
+++ b/openecomp-ui/test/licenseModel/featureGroups/LicenseModelFeatureGroupListEditor.test.js
@@ -16,75 +16,75 @@
import React from 'react';
import TestUtils from 'react-dom/test-utils';
-import {mapStateToProps} from 'sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js';
+import { mapStateToProps } from 'sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditor.js';
import FeatureGroupsListEditorView from 'sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupListEditorView.jsx';
import { FeatureGroupStoreFactory } from 'test-utils/factories/licenseModel/FeatureGroupFactories.js';
-import {LicenseModelOverviewFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
+import { LicenseModelOverviewFactory } from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
import { buildListFromFactory } from 'test-utils/Util.js';
import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js';
-describe('License Model Feature Group List Module Tests', function () {
+describe('License Model Feature Group List Module Tests', function() {
+ it('should mapper exist', () => {
+ expect(mapStateToProps).toBeTruthy();
+ });
- it('should mapper exist', () => {
- expect(mapStateToProps).toBeTruthy();
- });
+ it('should return empty data', () => {
+ let licenseModel = LicenseModelOverviewFactory.build({
+ featureGroup: {
+ featureGroupEditor: {},
+ featureGroupsList: []
+ },
+ licenseModelEditor: {
+ data: {
+ ...VersionControllerUtilsFactory.build()
+ }
+ }
+ });
+ var results = mapStateToProps({ licenseModel });
+ expect(results.vendorName).toEqual(undefined);
+ expect(results.featureGroupsList).toEqual([]);
+ });
+ it('should return true for show and edit mode and vendorName should be not empty', () => {
+ let licenseModel = LicenseModelOverviewFactory.build({
+ featureGroup: {
+ featureGroupEditor: {
+ data: FeatureGroupStoreFactory.build()
+ },
+ featureGroupsList: []
+ }
+ });
+ var results = mapStateToProps({ licenseModel });
+ expect(results.vendorName).toEqual(
+ licenseModel.licenseModelEditor.data.vendorName
+ );
+ });
- it('should return empty data', () => {
-
-
- let licenseModel = LicenseModelOverviewFactory.build({
- featureGroup: {
- featureGroupEditor: {},
- featureGroupsList: []
- },
- licenseModelEditor: {
- data:{
- ...VersionControllerUtilsFactory.build()
- }
- }
- });
- var results = mapStateToProps({licenseModel});
- expect(results.vendorName).toEqual(undefined);
- expect(results.featureGroupsModal.show).toEqual(false);
- expect(results.featureGroupsModal.editMode).toEqual(false);
- expect(results.featureGroupsList).toEqual([]);
- });
-
- it('should return true for show and edit mode and vendorName should be not empty', () => {
-
- let licenseModel = LicenseModelOverviewFactory.build({
- featureGroup: {
- featureGroupEditor: {
- data: FeatureGroupStoreFactory.build()
- },
- featureGroupsList: []
- }
- });
- var results = mapStateToProps({licenseModel});
- expect(results.featureGroupsModal.show).toEqual(true);
- expect(results.featureGroupsModal.editMode).toEqual(true);
- expect(results.vendorName).toEqual(licenseModel.licenseModelEditor.data.vendorName);
- });
-
- it('jsx view test', () => {
- var view = TestUtils.renderIntoDocument(<FeatureGroupsListEditorView vendorName=''
- licenseModelId=''
- featureGroupsModal={{show: false, editMode: false}}
- isReadOnlyMode={false}
- onAddFeatureGroupClick={()=>{}}
- featureGroupsList={[]} />);
- expect(view).toBeTruthy();
- });
-
- it('jsx view list test', () => {
- var view = TestUtils.renderIntoDocument(<FeatureGroupsListEditorView vendorName=''
- licenseModelId=''
- featureGroupsModal={{show: false, editMode: true}}
- isReadOnlyMode={false}
- onAddFeatureGroupClick={()=>{}}
- featureGroupsList={buildListFromFactory(FeatureGroupStoreFactory)} />);
- expect(view).toBeTruthy();
- });
+ it('jsx view test', () => {
+ var view = TestUtils.renderIntoDocument(
+ <FeatureGroupsListEditorView
+ vendorName=""
+ licenseModelId=""
+ isReadOnlyMode={false}
+ onAddFeatureGroupClick={() => {}}
+ featureGroupsList={[]}
+ />
+ );
+ expect(view).toBeTruthy();
+ });
+ it('jsx view list test', () => {
+ var view = TestUtils.renderIntoDocument(
+ <FeatureGroupsListEditorView
+ vendorName=""
+ licenseModelId=""
+ isReadOnlyMode={false}
+ onAddFeatureGroupClick={() => {}}
+ featureGroupsList={buildListFromFactory(
+ FeatureGroupStoreFactory
+ )}
+ />
+ );
+ expect(view).toBeTruthy();
+ });
});
diff --git a/openecomp-ui/test/licenseModel/test.js b/openecomp-ui/test/licenseModel/test.js
index bbebcaf079..0d72d5d369 100644
--- a/openecomp-ui/test/licenseModel/test.js
+++ b/openecomp-ui/test/licenseModel/test.js
@@ -96,11 +96,10 @@ describe('License Model Module Tests', function() {
};
const expectedSuccessModal = {
cancelButtonText: 'OK',
- modalClassName: 'notification-modal',
msg: 'This license model successfully submitted',
timeout: 2000,
title: 'Submit Succeeded',
- type: 'success'
+ type: 'info'
};
const versionsList = {
diff --git a/openecomp-ui/test/nfvo-components/editor/TabulatedEditor.test.js b/openecomp-ui/test/nfvo-components/editor/TabulatedEditor.test.js
index 0738bbb03d..cc694398ec 100644
--- a/openecomp-ui/test/nfvo-components/editor/TabulatedEditor.test.js
+++ b/openecomp-ui/test/nfvo-components/editor/TabulatedEditor.test.js
@@ -14,43 +14,55 @@
* limitations under the License.
*/
-
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import TestUtils from 'react-dom/test-utils';
import TabulatedEditor from 'nfvo-components/editor/TabulatedEditor.jsx';
import { Provider } from 'react-redux';
-import {storeCreator} from 'sdc-app/AppStore.js';
-
-describe('Tabulated Editor test: ', function () {
- const store = storeCreator();
- it('basic view test', () => {
- const renderer = new ShallowRenderer();
- renderer.render(
- <Provider store={store}><TabulatedEditor><button>test</button></TabulatedEditor></Provider>
- );
- let renderedOutput = renderer.getRenderOutput();
- expect(renderedOutput).toBeTruthy();
-
- });
+import { storeCreator } from 'sdc-app/AppStore.js';
- it('handle func test', () => {
- let props = {
- navigationBarProps: {
- groups: [],
- onNavigationItemClick: ()=>{}
- },
- versionControllerProps: {
- isCheckedOut: false,
- version: {id: '0.1', label: '0.1'},
- viewableVersions: [{id: '0.1', label: '0.1'}],
- itemPermission: {isCertified: false, isCollaborator: true, isDirty: false},
- onSubmit: ()=>{},
- onRevert: ()=>{}
- }
- };
- const view = TestUtils.renderIntoDocument(<Provider store={store}><TabulatedEditor {...props}><button>test</button></TabulatedEditor></Provider>);
- expect(view).toBeTruthy();
- });
+describe('Tabulated Editor test: ', function() {
+ const store = storeCreator();
+ it('basic view test', () => {
+ const renderer = new ShallowRenderer();
+ renderer.render(
+ <Provider store={store}>
+ <TabulatedEditor>
+ <button>test</button>
+ </TabulatedEditor>
+ </Provider>
+ );
+ let renderedOutput = renderer.getRenderOutput();
+ expect(renderedOutput).toBeTruthy();
+ });
+ it('handle func test', () => {
+ let props = {
+ navigationBarProps: {
+ groups: [],
+ onNavigationItemClick: () => {},
+ activeItemId: 'test'
+ },
+ versionControllerProps: {
+ isCheckedOut: false,
+ version: { id: '0.1', label: '0.1' },
+ viewableVersions: [{ id: '0.1', label: '0.1' }],
+ itemPermission: {
+ isCertified: false,
+ isCollaborator: true,
+ isDirty: false
+ },
+ onSubmit: () => {},
+ onRevert: () => {}
+ }
+ };
+ const view = TestUtils.renderIntoDocument(
+ <Provider store={store}>
+ <TabulatedEditor {...props}>
+ <button>test</button>
+ </TabulatedEditor>
+ </Provider>
+ );
+ expect(view).toBeTruthy();
+ });
});
diff --git a/openecomp-ui/test/onboard/filter/filterView.test.js b/openecomp-ui/test/onboard/filter/filterView.test.js
index 5e3c93bef2..9e6e1ee4c2 100644
--- a/openecomp-ui/test/onboard/filter/filterView.test.js
+++ b/openecomp-ui/test/onboard/filter/filterView.test.js
@@ -28,7 +28,7 @@ describe('Filter component view Tests', () => {
<Filter />
</Provider>
);
- const filter = wrapper.find('.catalog-filter');
+ const filter = wrapper.find('.catalog-filter').hostNodes();
expect(filter.hasClass('catalog-filter')).toBeTruthy();
});
});
diff --git a/openecomp-ui/test/softwareProduct/processes/test.js b/openecomp-ui/test/softwareProduct/processes/test.js
index 6ad696ae85..90de1e327f 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 () {
-
- let restPrefix = '';
-
- beforeAll(function() {
- restPrefix = Configuration.get('restPrefix');
- deepFreeze(restPrefix);
- });
-
- //**
- //** ADD
- //**
- it('Add Software Products Processes', () => {
-
- const store = storeCreator();
- deepFreeze(store.getState());
-
- const softwareProductProcessFromResponse = 'ADDED_ID';
-
- const softwareProductProcessAfterAdd = VSPProcessStoreFactory.build({id: softwareProductProcessFromResponse});
- const softwareProductPostRequest = buildFromExistingObject(VSPProcessPostFactory, softwareProductProcessAfterAdd);
-
- 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: softwareProductProcessFromResponse
- };
- });
-
- return SoftwareProductProcessesActionHelper.saveProcess(store.dispatch,
- {
- softwareProductId,
- version,
- previousProcess: null,
- process: softwareProductPostRequest
- }
- ).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
-
- it('Add Software Products Processes with type', () => {
-
- const store = storeCreator();
- deepFreeze(store.getState());
-
- const softwareProductProcessFromResponse = 'ADDED_ID';
-
- const softwareProductProcessAfterAdd = VSPProcessStoreFactoryWithType.build({id: softwareProductProcessFromResponse});
- const softwareProductPostRequest = buildFromExistingObject(VSPProcessPostFactoryWithType, softwareProductProcessAfterAdd);
-
- 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: softwareProductProcessFromResponse
- };
- });
-
- 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,
- version,
- previousProcess: null,
- process: softwareProductProcessToAdd
- }
- ).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
-
- //**
- //** UPDATE
- //**
- it('Update Software Products Processes', () => {
- const softwareProductProcessesList = VSPProcessStoreWithArtifactNameFactory.buildList(1);
- deepFreeze(softwareProductProcessesList);
-
- const store = storeCreator({
- softwareProduct: {
- softwareProductProcesses: {
- processesList: softwareProductProcessesList
- }
- }
- });
- deepFreeze(store.getState());
-
- const toBeUpdatedProcessId = softwareProductProcessesList[0].id;
- const previousProcessData = softwareProductProcessesList[0];
- const processUpdateData = VSPProcessStoreWithArtifactNameFactory.build(
- {...previousProcessData,
- name: 'Pr1_UPDATED',
- description: 'string_UPDATED',
- type: 'Other'
- }
- );
-
- deepFreeze(processUpdateData);
-
- const processPutRequest = VSPProcessPostFactory.build({
- name: 'Pr1_UPDATED',
- description: 'string_UPDATED',
- type: 'Other'
- });
- deepFreeze(processPutRequest);
-
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', [processUpdateData]);
-
-
- 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);
-
- deepFreeze(store.getState());
-
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', softwareProductProcessesList);
-
- 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};
- });
-
- return SoftwareProductProcessesActionHelper.fetchProcessesList(store.dispatch, {softwareProductId, version}).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
-
- //**
- //** DELETE
- //**
- it('Delete Software Products Processes', () => {
- const softwareProductProcessesList = VSPProcessStoreWithArtifactNameFactory.buildList(1);
- const currentSoftwareProduct = VSPEditorFactory.build();
-
- deepFreeze(softwareProductProcessesList);
- const store = storeCreator({
- softwareProduct: {
- softwareProductProcesses: {
- processesList: softwareProductProcessesList
- },
- softwareProductEditor: {
- data: currentSoftwareProduct
- }
- }
- });
-
- const processId = softwareProductProcessesList[0].id;
- const versionId = version.id;
- deepFreeze(store.getState());
-
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesList', []);
-
- 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.deleteProcess(store.dispatch, {
- process: softwareProductProcessesList[0],
- softwareProductId,
- version
- }).then(() => {
- expect(store.getState()).toEqual(expectedStore);
- });
- });
-
- it('Validating Software Products Processes Delete confirmation', () => {
- const store = storeCreator();
- deepFreeze(store.getState());
-
- let process = VSPProcessStoreFactory.build();
- deepFreeze(process);
-
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processToDelete', process);
-
- return SoftwareProductProcessesActionHelper.openDeleteProcessesConfirm(store.dispatch, {process});
-
- expect(store.getState()).toEqual(expectedStore);
- });
-
- it('Validating Software Products Processes Cancel Delete', () => {
- const store = storeCreator();
- deepFreeze(store.getState());
-
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processToDelete', false);
-
- SoftwareProductProcessesActionHelper.hideDeleteConfirm(store.dispatch);
-
- expect(store.getState()).toEqual(expectedStore);
- });
-
- //**
- //** CREATE/EDIT
- //**
- it('Validating open Software Products Processes for create', () => {
- const store = storeCreator();
- deepFreeze(store.getState());
-
- let process = {};
- deepFreeze(process);
-
- const expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductProcesses.processesEditor.data', process);
-
- SoftwareProductProcessesActionHelper.openEditor(store.dispatch);
- expect(store.getState().softwareProduct.softwareProductProcesses.processesEditor.data).toEqual(expectedStore.softwareProduct.softwareProductProcesses.processesEditor.data);
- });
-
- 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);
- expect(store.getState()).toEqual(expectedStore);
- });
-
- it('Validating open Software Products Processes for editing', () => {
- const store = storeCreator();
- deepFreeze(store.getState());
-
- 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);
-
- });
-
+describe('Software Product Processes Module Tests', function() {
+ let restPrefix = '';
+
+ beforeAll(function() {
+ restPrefix = Configuration.get('restPrefix');
+ deepFreeze(restPrefix);
+ });
+
+ //**
+ //** ADD
+ //**
+ it('Add Software Products Processes', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
+
+ const softwareProductProcessFromResponse = 'ADDED_ID';
+
+ const softwareProductProcessAfterAdd = VSPProcessStoreFactory.build({
+ id: softwareProductProcessFromResponse
+ });
+ const softwareProductPostRequest = buildFromExistingObject(
+ VSPProcessPostFactory,
+ softwareProductProcessAfterAdd
+ );
+
+ 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: softwareProductProcessFromResponse
+ };
+ });
+
+ return SoftwareProductProcessesActionHelper.saveProcess(
+ store.dispatch,
+ {
+ softwareProductId,
+ version,
+ previousProcess: null,
+ process: softwareProductPostRequest
+ }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
+
+ it('Add Software Products Processes with type', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
+
+ const softwareProductProcessFromResponse = 'ADDED_ID';
+
+ const softwareProductProcessAfterAdd = VSPProcessStoreFactoryWithType.build(
+ { id: softwareProductProcessFromResponse }
+ );
+ const softwareProductPostRequest = buildFromExistingObject(
+ VSPProcessPostFactoryWithType,
+ softwareProductProcessAfterAdd
+ );
+
+ 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: softwareProductProcessFromResponse
+ };
+ });
+
+ 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,
+ version,
+ previousProcess: null,
+ process: softwareProductProcessToAdd
+ }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
+
+ //**
+ //** UPDATE
+ //**
+ it('Update Software Products Processes', () => {
+ const softwareProductProcessesList = VSPProcessStoreWithArtifactNameFactory.buildList(
+ 1
+ );
+ deepFreeze(softwareProductProcessesList);
+
+ const store = storeCreator({
+ softwareProduct: {
+ softwareProductProcesses: {
+ processesList: softwareProductProcessesList
+ }
+ }
+ });
+ deepFreeze(store.getState());
+
+ const toBeUpdatedProcessId = softwareProductProcessesList[0].id;
+ const previousProcessData = softwareProductProcessesList[0];
+ const processUpdateData = VSPProcessStoreWithArtifactNameFactory.build({
+ ...previousProcessData,
+ name: 'Pr1_UPDATED',
+ description: 'string_UPDATED',
+ type: 'Other'
+ });
+
+ deepFreeze(processUpdateData);
+
+ const processPutRequest = VSPProcessPostFactory.build({
+ name: 'Pr1_UPDATED',
+ description: 'string_UPDATED',
+ type: 'Other'
+ });
+ deepFreeze(processPutRequest);
+
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processesList',
+ [processUpdateData]
+ );
+
+ 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);
+
+ deepFreeze(store.getState());
+
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processesList',
+ softwareProductProcessesList
+ );
+
+ 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 };
+ });
+
+ return SoftwareProductProcessesActionHelper.fetchProcessesList(
+ store.dispatch,
+ { softwareProductId, version }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
+
+ //**
+ //** DELETE
+ //**
+ it('Delete Software Products Processes', () => {
+ const softwareProductProcessesList = VSPProcessStoreWithArtifactNameFactory.buildList(
+ 1
+ );
+ const currentSoftwareProduct = VSPEditorFactory.build();
+
+ deepFreeze(softwareProductProcessesList);
+ const store = storeCreator({
+ softwareProduct: {
+ softwareProductProcesses: {
+ processesList: softwareProductProcessesList
+ },
+ softwareProductEditor: {
+ data: currentSoftwareProduct
+ }
+ }
+ });
+
+ const processId = softwareProductProcessesList[0].id;
+ const versionId = version.id;
+ deepFreeze(store.getState());
+
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processesList',
+ []
+ );
+
+ 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.deleteProcess(
+ store.dispatch,
+ {
+ process: softwareProductProcessesList[0],
+ softwareProductId,
+ version
+ }
+ ).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
+
+ it('Validating Software Products Processes Delete confirmation', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
+
+ let process = VSPProcessStoreFactory.build();
+ deepFreeze(process);
+
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processToDelete',
+ process
+ );
+
+ return SoftwareProductProcessesActionHelper.openDeleteProcessesConfirm(
+ store.dispatch,
+ { process }
+ );
+
+ expect(store.getState()).toEqual(expectedStore);
+ });
+
+ it('Validating Software Products Processes Cancel Delete', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
+
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'softwareProduct.softwareProductProcesses.processToDelete',
+ false
+ );
+
+ SoftwareProductProcessesActionHelper.hideDeleteConfirm(store.dispatch);
+
+ expect(store.getState()).toEqual(expectedStore);
+ });
+
+ //**
+ //** CREATE/EDIT
+ //**
+
+ 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);
+ expect(store.getState()).toEqual(expectedStore);
+ });
+
+ it('Validating open Software Products Processes for editing', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
+
+ 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
+ );
+ });
});
diff --git a/openecomp-ui/test/softwareProduct/test.js b/openecomp-ui/test/softwareProduct/test.js
index 91b4e7d40e..489b9829b5 100644
--- a/openecomp-ui/test/softwareProduct/test.js
+++ b/openecomp-ui/test/softwareProduct/test.js
@@ -71,11 +71,10 @@ describe('Software Product Module Tests', function() {
};
const expectedSuccessModal = {
cancelButtonText: 'OK',
- modalClassName: 'notification-modal',
msg: 'This software product successfully submitted',
timeout: 2000,
title: 'Submit Succeeded',
- type: 'success'
+ type: 'info'
};
let expectedStore = store.getState();
diff --git a/openecomp-ui/test/utils/errorResponseHandler.test.js b/openecomp-ui/test/utils/errorResponseHandler.test.js
index cae8bc4955..de2b8b2d5e 100644
--- a/openecomp-ui/test/utils/errorResponseHandler.test.js
+++ b/openecomp-ui/test/utils/errorResponseHandler.test.js
@@ -1,5 +1,5 @@
/*
- * Copyright © 2016-2017 European Support Limited
+ * 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.
@@ -15,119 +15,132 @@
*/
import deepFreeze from 'deep-freeze';
-import {cloneAndSet} from '../../test-utils/Util.js';
+import { cloneAndSet } from '../../test-utils/Util.js';
import store from 'sdc-app/AppStore.js';
import errorResponseHandler from 'nfvo-utils/ErrorResponseHandler.js';
-import {typeEnum as modalType} from 'nfvo-components/modal/GlobalModalConstants.js';
+import { typeEnum as modalType } from 'nfvo-components/modal/GlobalModalConstants.js';
describe('Error Response Handler Util', () => {
-
- beforeEach(function () {
- deepFreeze(store.getState());
- });
-
- it('validating error in policyException', () => {
- let textStatus = '', errorThrown = '';
- let xhr = {
- data: {
- requestError: {
- policyException: {
- messageId: 'SVC4122',
- text: 'Error: Invalid data.'
- }
- }
- }
- };
- deepFreeze(xhr);
-
- const errorNotification = {
- title: 'Error: SVC4122',
- msg: 'Error: Invalid data.',
- modalClassName: 'notification-modal',
- type: modalType.ERROR
- };
-
-
-
- const expectedStore = cloneAndSet(store.getState(), 'modal', errorNotification);
-
- errorResponseHandler(xhr, textStatus, errorThrown);
-
- expect(store.getState()).toEqual(expectedStore);
- });
-
- it('validating error in serviceException with variables', () => {
- let textStatus = '', errorThrown = '';
- let xhr = {
- data: {
- requestError: {
- serviceException: {
- messageId: 'SVC4122',
- text: "Error: Invalid artifact type '%1'.",
- variables: ['newType']
- }
- }
- }
- };
- deepFreeze(xhr);
-
- const errorNotification = {
- title: 'Error: SVC4122',
- msg: 'Error: Invalid artifact type newType.',
- modalClassName: 'notification-modal',
- type: modalType.ERROR
- };
-
- const expectedStore = cloneAndSet(store.getState(), 'modal', errorNotification);
-
- errorResponseHandler(xhr, textStatus, errorThrown);
-
- expect(store.getState()).toEqual(expectedStore);
- });
-
- it('validating error in response', () => {
- let textStatus = '', errorThrown = '';
- let xhr = {
- data: {
- status: 'AA',
- message: 'Error: Invalid data.'
- }
- };
- deepFreeze(xhr);
-
- const errorNotification = {
- title: 'AA',
- msg: 'Error: Invalid data.',
- modalClassName: 'notification-modal',
- type: modalType.ERROR
- };
-
- const expectedStore = cloneAndSet(store.getState(), 'modal', errorNotification);
-
- errorResponseHandler(xhr, textStatus, errorThrown);
-
- expect(store.getState()).toEqual(expectedStore);
- });
-
- it('validating error in request', () => {
- let textStatus = '', errorThrown = '';
- let xhr = {
- statusText: '500',
- responseText: 'Internal server error.'
- };
- deepFreeze(xhr);
-
- const errorNotification = {
- title: '500',
- msg: 'Internal server error.',
- modalClassName: 'notification-modal',
- type: modalType.ERROR
- };
-
- const expectedStore = cloneAndSet(store.getState(), 'modal', errorNotification);
-
- errorResponseHandler(xhr, textStatus, errorThrown);
-
- expect(store.getState()).toEqual(expectedStore);
- });
+ beforeEach(function() {
+ deepFreeze(store.getState());
+ });
+
+ it('validating error in policyException', () => {
+ let textStatus = '',
+ errorThrown = '';
+ let xhr = {
+ data: {
+ requestError: {
+ policyException: {
+ messageId: 'SVC4122',
+ text: 'Error: Invalid data.'
+ }
+ }
+ }
+ };
+ deepFreeze(xhr);
+
+ const errorNotification = {
+ title: 'Error: SVC4122',
+ msg: 'Error: Invalid data.',
+ type: modalType.ERROR
+ };
+
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'modal',
+ errorNotification
+ );
+
+ errorResponseHandler(xhr, textStatus, errorThrown);
+
+ expect(store.getState()).toEqual(expectedStore);
+ });
+
+ it('validating error in serviceException with variables', () => {
+ let textStatus = '',
+ errorThrown = '';
+ let xhr = {
+ data: {
+ requestError: {
+ serviceException: {
+ messageId: 'SVC4122',
+ text: "Error: Invalid artifact type '%1'.",
+ variables: ['newType']
+ }
+ }
+ }
+ };
+ deepFreeze(xhr);
+
+ const errorNotification = {
+ title: 'Error: SVC4122',
+ msg: 'Error: Invalid artifact type newType.',
+ type: modalType.ERROR
+ };
+
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'modal',
+ errorNotification
+ );
+
+ errorResponseHandler(xhr, textStatus, errorThrown);
+
+ expect(store.getState()).toEqual(expectedStore);
+ });
+
+ it('validating error in response', () => {
+ let textStatus = '',
+ errorThrown = '';
+ let xhr = {
+ data: {
+ status: 'AA',
+ message: 'Error: Invalid data.'
+ }
+ };
+ deepFreeze(xhr);
+
+ const errorNotification = {
+ title: 'AA',
+ msg: 'Error: Invalid data.',
+ type: modalType.ERROR
+ };
+
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'modal',
+ errorNotification
+ );
+
+ errorResponseHandler(xhr, textStatus, errorThrown);
+
+ expect(store.getState()).toEqual(expectedStore);
+ });
+
+ it('validating error in request', () => {
+ let textStatus = '',
+ errorThrown = '';
+ let xhr = {
+ statusText: '500',
+ responseText: 'Internal server error.'
+ };
+ deepFreeze(xhr);
+
+ const errorNotification = {
+ title: '500',
+ msg: 'Internal server error.',
+ type: modalType.ERROR
+ };
+
+ const expectedStore = cloneAndSet(
+ store.getState(),
+ 'modal',
+ errorNotification
+ );
+
+ errorResponseHandler(xhr, textStatus, errorThrown);
+
+ expect(store.getState()).toEqual(expectedStore);
+ });
});