aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/storeUtil/utils
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/src/app/shared/storeUtil/utils')
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.spec.ts41
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.ts1
2 files changed, 40 insertions, 2 deletions
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.spec.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.spec.ts
index 952a92842..4bad61326 100644
--- a/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.spec.ts
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.spec.ts
@@ -178,7 +178,7 @@ describe('generalReducer', () => {
expect(userState).toEqual(userId);
});
- test('#DELETE_VNF_INSTANCE : should delete existing vnf', () => {
+ test('#REMOVE_INSTANCE : should delete existing vnf', () => {
let state = generalReducer(<any>{serviceInstance : {
'serviceModelId' : {
vnfs : {
@@ -202,7 +202,7 @@ describe('generalReducer', () => {
expect(state.serviceInstance[ 'serviceModelId'].vnfs['modelName']).not.toBeDefined();
});
- test('#DELETE_VNF_INSTANCE : should delete existing network', () => {
+ test('#REMOVE_INSTANCE : should delete existing network', () => {
let state = generalReducer(<any>{serviceInstance : {
'serviceModelId' : {
'networks' : {
@@ -226,6 +226,43 @@ describe('generalReducer', () => {
expect(state.serviceInstance['serviceModelId'].networks['modelName']).not.toBeDefined();
});
+ test('#REMOVE_INSTANCE : remove VNF should remove VFModules ', () => {
+ let state = generalReducer(<any>
+ {serviceInstance : {
+ 'serviceModelId' : {
+ 'validationCounter' : 2,
+ 'vnfs' : {
+ 'SDC_Automation_15Aug 0' : {
+ 'isMissingData' :true,
+ 'modelName' : {},
+ 'vfModules' : {
+ 'vfModule_1' : {
+ 'vfModule_1_1' : {
+ 'isMissingData' :true
+ }
+ }
+ }
+ }
+ }
+ }
+ }},
+ <RemoveInstanceAction>{
+ type: GeneralActions.REMOVE_INSTANCE,
+ modelName : 'modelName',
+ serviceModelId : 'serviceModelId',
+ storeKey : 'SDC_Automation_15Aug 0',
+ node : {
+ data : {
+ type : 'VF'
+ }
+ }
+ });
+
+ expect(state).toBeDefined();
+ expect(state.serviceInstance['serviceModelId'].vnfs['modelName']).not.toBeDefined();
+ expect(state.serviceInstance['serviceModelId'].validationCounter).toEqual(0);
+ });
+
test('#CHANGE_VNF_INSTANCE_COUNTER : should init existingVNFCounterMap to 1', () => {
let state = generalReducer(<any>{serviceInstance : {
'serviceModelId' : {
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.ts
index f87a97397..924d58a8a 100644
--- a/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.ts
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.ts
@@ -55,6 +55,7 @@ export function generalReducer(state: ServiceState, action: Action) : ServiceSta
_.forOwn(state.serviceInstance[actionData.serviceModelId][typeNodeInformation.hierarchyName][actionData.storeKey].vfModules, (vfModuleMap) => {
_.forOwn(vfModuleMap, (vfModuleInstance) => {
updateUniqueNames(vfModuleInstance.instanceName, null, state.serviceInstance[actionData.serviceModelId]);
+ updateServiceValidationCounter(state, vfModuleInstance.isMissingData, false, actionData.serviceModelId);
})
});
}