diff options
author | 2020-02-24 12:58:39 +0200 | |
---|---|---|
committer | 2020-02-24 15:30:04 +0200 | |
commit | 94cd52bc1fe7b997802dd71952c18d67cb2cd12a (patch) | |
tree | 4465b41a9c82f6983f90e520ffd95dd93db095e8 /vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts | |
parent | bf58511a20b396e97ab0a88dfe6fce3d7a54395f (diff) |
Show "retain VG" for vfModule that is allowed or that is an "alien"
Issue-ID: Issue-ID: VID-771
Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Change-Id: Ie52fa194a92e0b9e21df723b708b4db877712068
Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts index 578c37ef0..2123d6a9f 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts @@ -1,6 +1,10 @@ import {LogService} from "../../../../utils/log/log.service"; import {NgRedux} from "@angular-redux/store"; -import {ControlGeneratorUtil, SDN_C_PRE_LOAD, SUPPLEMENTARY_FILE} from "../../../genericForm/formControlsServices/control.generator.util.service"; +import { + ControlGeneratorUtil, + SDN_C_PRE_LOAD, + SUPPLEMENTARY_FILE +} from "../../../genericForm/formControlsServices/control.generator.util.service"; import {AaiService} from "../../../../services/aaiService/aai.service"; import {HttpClient} from "@angular/common/http"; import {GenericFormService} from "../../../genericForm/generic-form.service"; @@ -9,7 +13,6 @@ import {IframeService} from "../../../../utils/iframe.service"; import {DefaultDataGeneratorService} from "../../../../services/defaultDataServiceGenerator/default.data.generator.service"; import {BasicPopupService} from "../basic.popup.service"; import {VfModuleControlGenerator} from "../../../genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator"; -import {SdcUiServices} from "onap-ui-angular"; import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service"; import {getTestBed, TestBed} from "@angular/core/testing"; import {UpgradeFormControlNames, VfModuleUpgradePopupService} from "./vfModule.upgrade.popuop.service"; @@ -65,6 +68,7 @@ describe('VFModule popup service', () => { let fb: FormBuilder; let iframeService: IframeService; let store : NgRedux<AppState>; + let _sharedTreeService : SharedTreeService; beforeAll(done => (async () => { TestBed.configureTestingModule({ @@ -95,8 +99,12 @@ describe('VFModule popup service', () => { defaultDataGeneratorService = injector.get(DefaultDataGeneratorService); fb = injector.get(FormBuilder); iframeService = injector.get(IframeService); + _sharedTreeService = injector.get(SharedTreeService); store = injector.get(NgRedux); service.uuidData = { + vfModule: { + data: {} + }, modelName: 'vfModuleName', vFModuleStoreKey: 'vfModuleId' }; @@ -133,11 +141,16 @@ describe('VFModule popup service', () => { getControlByNameAndCheckValue(UpgradeFormControlNames.RETAIN_VOLUME_GROUPS, true, true); }); - test('get controls should NOT return retainVolumeGroup control with true value', ()=> { - let stateCopy =_.cloneDeep(store.getState()); - stateCopy.service.serviceHierarchy['serviceId'].vfModules['vfModuleName'].volumeGroupAllowed = false; - jest.spyOn(store, 'getState').mockReturnValue(stateCopy); - getControlByNameAndCheckValue(UpgradeFormControlNames.RETAIN_VOLUME_GROUPS, null, false); + [true, false].forEach(notExistsOnModel => { + test(`retainVolumeGroup control is shown when vfModule not from model (notExistsOnModel=${notExistsOnModel})`, () => { + let stateCopy = _.cloneDeep(store.getState()); + stateCopy.service.serviceHierarchy['serviceId'].vfModules['vfModuleName'].volumeGroupAllowed = false; + jest.spyOn(store, 'getState').mockReturnValue(stateCopy); + + jest.spyOn(_sharedTreeService, 'isVfModuleCustomizationIdNotExistsOnModel').mockReturnValue(notExistsOnModel); + + getControlByNameAndCheckValue(UpgradeFormControlNames.RETAIN_VOLUME_GROUPS, true, notExistsOnModel); + }); }); test('get controls should contain SUPPLEMENTARY_FILE controller', ()=> { |