diff options
author | Yoav Schneiderman <yoav.schneiderman@intl.att.com> | 2019-12-23 09:54:07 +0200 |
---|---|---|
committer | Yoav Schneiderman <yoav.schneiderman@intl.att.com> | 2019-12-23 09:54:07 +0200 |
commit | 879ed7a6358e920595010f8c915e0df8fd2dba0e (patch) | |
tree | 8b864e2045a17ec3bbcbb3e49011603ac4302189 /vid-webpack-master/src/app/shared | |
parent | 9cdddba38b571d9d4df5d44523c0a09a64ab5de6 (diff) |
When remove VND with existing VFModules - should update Validation counter
Issue-ID: VID-734
Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Change-Id: I41cb2f010fc1aee4638f4f1b7c49af2be97ed2f3
Diffstat (limited to 'vid-webpack-master/src/app/shared')
-rw-r--r-- | vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.spec.ts | 41 | ||||
-rw-r--r-- | vid-webpack-master/src/app/shared/storeUtil/utils/general/general.reducers.ts | 1 |
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); }) }); } |