aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-ui/test/softwareProduct/components/network
diff options
context:
space:
mode:
authorAvi Ziv <avi.ziv@amdocs.com>2017-07-18 19:45:38 +0300
committerAvi Ziv <avi.ziv@amdocs.com>2017-07-18 19:45:38 +0300
commitb8e2faf476202b6ffe61bc3a9a37df1304881d40 (patch)
treef78b8c0517d8e16c5ae610bf8b49f68ea8a312a1 /openecomp-ui/test/softwareProduct/components/network
parent75aacbbe1acf78fa53378f07f0a8c7769449a17e (diff)
[SDC] Onboarding 1710 rebase.
Change-Id: If3b6b81d221fde13908f1e8160db6f7d9433c535 Signed-off-by: Avi Ziv <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-ui/test/softwareProduct/components/network')
-rw-r--r--openecomp-ui/test/softwareProduct/components/network/SoftwareProductComponentsNetworkActionHelper.test.js64
1 files changed, 59 insertions, 5 deletions
diff --git a/openecomp-ui/test/softwareProduct/components/network/SoftwareProductComponentsNetworkActionHelper.test.js b/openecomp-ui/test/softwareProduct/components/network/SoftwareProductComponentsNetworkActionHelper.test.js
index f5a10e23c9..b6050265a6 100644
--- a/openecomp-ui/test/softwareProduct/components/network/SoftwareProductComponentsNetworkActionHelper.test.js
+++ b/openecomp-ui/test/softwareProduct/components/network/SoftwareProductComponentsNetworkActionHelper.test.js
@@ -19,7 +19,7 @@ import {cloneAndSet} from 'test-utils/Util.js';
import {storeCreator} from 'sdc-app/AppStore.js';
import SoftwareProductComponentsNetworkActionHelper from 'sdc-app/onboarding/softwareProduct/components/network/SoftwareProductComponentsNetworkActionHelper.js';
-import {VSPComponentsNicFactory, VSPComponentsNetworkFactory, VSPComponentsNetworkQDataFactory, VSPComponentsNetworkDataMapFactory, VSPComponentsNicFactoryGenericFieldInfo} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js';
+import {VSPComponentsNicPostFactory, VSPComponentsNicFactory, VSPComponentsNetworkFactory, VSPComponentsNetworkQDataFactory, VSPComponentsNetworkDataMapFactory, VSPComponentsNicFactoryGenericFieldInfo} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsNetworkFactories.js';
import VersionControllerUtilsFactory from 'test-utils/factories/softwareProduct/VersionControllerUtilsFactory.js';
import VSPQSchemaFactory from 'test-utils/factories/softwareProduct/SoftwareProductQSchemaFactory.js';
import {forms} from 'sdc-app/onboarding/softwareProduct/components/SoftwareProductComponentsConstants.js';
@@ -55,7 +55,60 @@ describe('Software Product Components Network Action Helper Tests', function ()
});
});
-
+ it('Add NIC', () => {
+ const store = storeCreator();
+ deepFreeze(store.getState());
+
+ const NICPostRequest = VSPComponentsNicPostFactory.build();
+
+ const expectedNIC = VSPComponentsNicFactory.build({...NICPostRequest, id: nicId});
+
+ mockRest.addHandler('post', ({options, data, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-software-products/${softwareProductId}/versions/${version.id}/components/${componentId}/nics`);
+ expect(data).toEqual(NICPostRequest);
+ expect(options).toEqual(undefined);
+ return {
+ nicId
+ };
+ });
+
+ mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-software-products/${softwareProductId}/versions/${version.id}/components/${componentId}/nics`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {results: [expectedNIC]};
+ });
+
+ mockRest.addHandler('destroy', ({options, data, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-software-products/${softwareProductId}/versions/${version.id}/components/${componentId}/nics/${nicId}`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {};
+ });
+
+ mockRest.addHandler('fetch', ({options, data, baseUrl}) => {
+ expect(baseUrl).toEqual(`/onboarding-api/v1.0/vendor-software-products/${softwareProductId}/versions/${version.id}/components/${componentId}/nics`);
+ expect(data).toEqual(undefined);
+ expect(options).toEqual(undefined);
+ return {results: []};
+ });
+
+ const network = VSPComponentsNetworkFactory.build({
+ nicList: [expectedNIC]
+ });
+
+ const networkAfterDelete = VSPComponentsNetworkFactory.build();
+
+ let expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductComponents.network', network);
+
+ return SoftwareProductComponentsNetworkActionHelper.createNIC(store.dispatch, {nic: NICPostRequest, softwareProductId, componentId, version}).then(() => {
+ expect(store.getState()).toEqual(expectedStore);
+ return SoftwareProductComponentsNetworkActionHelper.deleteNIC(store.dispatch, {softwareProductId, componentId, nicId, version});
+ }).then(() => {
+ let expectedStore = cloneAndSet(store.getState(), 'softwareProduct.softwareProductComponents.network', networkAfterDelete);
+ expect(store.getState()).toEqual(expectedStore);
+ });
+ });
it('open NICE editor', () => {
const store = storeCreator();
@@ -83,7 +136,7 @@ describe('Software Product Components Network Action Helper Tests', function ()
SoftwareProductComponentsNetworkActionHelper.openNICEditor(store.dispatch, {nic, data});
- expect(store.getState()).toEqual(expectedStore);
+ expect(store.getState().softwareProduct.softwareProductComponents.network).toEqual(expectedStore.softwareProduct.softwareProductComponents.network);
});
it('close NICE editor', () => {
@@ -102,7 +155,7 @@ describe('Software Product Components Network Action Helper Tests', function ()
});
it('Load NIC data', () => {
-
+ mockRest.resetQueue();
const expectedData = VSPComponentsNicFactory.build();
deepFreeze(expectedData);
@@ -121,7 +174,7 @@ describe('Software Product Components Network Action Helper Tests', function ()
it('load NIC Questionnaire', () => {
-
+ mockRest.resetQueue();
const store = storeCreator();
deepFreeze(store.getState());
@@ -171,6 +224,7 @@ describe('Software Product Components Network Action Helper Tests', function ()
const network = {
nicEditor: {},
+ nicCreation: {},
nicList: [
expectedData
]