import {getTestBed, TestBed} from '@angular/core/testing';
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing';
import {NgRedux} from '@angular-redux/store';
-import {BasicControlGenerator} from "../basic.control.generator";
+import {ControlGeneratorUtil, SDN_C_PRE_LOAD} from "../control.generator.util.service";
import {AaiService} from "../../../../services/aaiService/aai.service";
import {GenericFormService} from "../../generic-form.service";
import {FormBuilder} from "@angular/forms";
ValidatorOptions
} from "../../../../models/formControlModels/formControl.model";
import {FormControlNames, VfModuleControlGenerator} from "./vfModule.control.generator";
-import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service";
+import {FeatureFlagsService, Features} from "../../../../services/featureFlag/feature-flags.service";
+import {VfModuleInstance} from "../../../../models/vfModuleInstance";
+import {VfModule} from "../../../../models/vfModule";
+import {SharedControllersService} from "../sharedControlles/shared.controllers.service";
+import {AppState} from "../../../../store/reducers";
+import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
+import {instance, mock, when} from "ts-mockito";
+import each from "jest-each";
class MockAppStore<T> {
getState() {
"FLAG_NETWORK_TO_ASYNC_INSTANTIATION": false,
"FLAG_SHOW_ASSIGNMENTS": true,
"FLAG_FABRIC_CONFIGURATION_ASSIGNMENTS": true,
- "FLAG_UNASSIGN_SERVICE": true,
"FLAG_SHOW_VERIFY_SERVICE": false,
- "FLAG_COLLECTION_RESOURCE_SUPPORT": true,
- "FLAG_DUPLICATE_VNF": true,
"FLAG_SERVICE_MODEL_CACHE": true,
- "CREATE_INSTANCE_TEST": false,
- "FLAG_SETTING_DEFAULTS_IN_DRAWING_BOARD": false,
- "FLAG_ASYNC_INSTANTIATION": true,
- "FLAG_ASYNC_JOBS": true,
- "EMPTY_DRAWING_BOARD_TEST": false,
"FLAG_ADD_MSO_TESTAPI_FIELD": true
},
"type": "[FLAGS] Update"
"inputs": {}
},
"vnfs": {
- "VF_vMee 0": {
+ "VF_vGeraldine 0": {
"uuid": "d6557200-ecf2-4641-8094-5393ae3aae60",
"invariantUuid": "4160458e-f648-4b30-a176-43881ffffe9e",
- "description": "VSP_vMee",
- "name": "VF_vMee",
+ "description": "VSP_vGeraldine",
+ "name": "VF_vGeraldine",
"version": "2.0",
"customizationUuid": "91415b44-753d-494c-926a-456a9172bbb9",
"inputs": {},
"sctp-b-egress-dst_end_port": "65535.0"
},
"type": "VF",
- "modelCustomizationName": "VF_vMee 0",
+ "modelCustomizationName": "VF_vGeraldine 0",
"vfModules": {
- "vf_vmee0..VfVmee..vmme_vlc..module-1": {
+ "vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1": {
"uuid": "522159d5-d6e0-4c2a-aa44-5a542a12a830",
"invariantUuid": "98a7c88b-b577-476a-90e4-e25a5871e02b",
"customizationUuid": "55b1be94-671a-403e-a26c-667e9c47d091",
"description": null,
- "name": "VfVmee..vmme_vlc..module-1",
+ "name": "VfVgeraldine..vflorence_vlc..module-1",
"version": "2",
- "modelCustomizationName": "VfVmee..vmme_vlc..module-1",
+ "modelCustomizationName": "VfVgeraldine..vflorence_vlc..module-1",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "vmme_vlc"
+ "vfModuleLabel": "vflorence_vlc"
},
"inputs": {},
"volumeGroupAllowed": true
},
- "vf_vmee0..VfVmee..vmme_gpb..module-2": {
+ "vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2": {
"uuid": "41708296-e443-4c71-953f-d9a010f059e1",
"invariantUuid": "1cca90b8-3490-495e-87da-3f3e4c57d5b9",
"customizationUuid": "6add59e0-7fe1-4bc4-af48-f8812422ae7c",
"description": null,
- "name": "VfVmee..vmme_gpb..module-2",
+ "name": "VfVgeraldine..vflorence_gpb..module-2",
"version": "2",
- "modelCustomizationName": "VfVmee..vmme_gpb..module-2",
+ "modelCustomizationName": "VfVgeraldine..vflorence_gpb..module-2",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "vmme_gpb"
+ "vfModuleLabel": "vflorence_gpb"
},
"inputs": {},
"volumeGroupAllowed": false
},
- "vf_vmee0..VfVmee..base_vmme..module-0": {
+ "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0": {
"uuid": "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
"invariantUuid": "a6f9e51a-2b35-416a-ae15-15e58d61f36d",
"customizationUuid": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
"description": null,
- "name": "VfVmee..base_vmme..module-0",
+ "name": "VfVgeraldine..base_vflorence..module-0",
"version": "2",
- "modelCustomizationName": "VfVmee..base_vmme..module-0",
+ "modelCustomizationName": "VfVgeraldine..base_vflorence..module-0",
"properties": {
"minCountInstances": 1,
"maxCountInstances": 1,
"initialCount": 1,
- "vfModuleLabel": "base_vmme"
+ "vfModuleLabel": "base_vflorence"
},
"inputs": {},
"volumeGroupAllowed": true
}
},
"volumeGroups": {
- "vf_vmee0..VfVmee..base_vmme..module-0": {
+ "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0": {
"uuid": "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
"invariantUuid": "a6f9e51a-2b35-416a-ae15-15e58d61f36d",
"customizationUuid": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
"description": null,
- "name": "VfVmee..base_vmme..module-0",
+ "name": "VfVgeraldine..base_vflorence..module-0",
"version": "2",
- "modelCustomizationName": "VfVmee..base_vmme..module-0",
+ "modelCustomizationName": "VfVgeraldine..base_vflorence..module-0",
"properties": {
"minCountInstances": 1,
"maxCountInstances": 1,
"initialCount": 1,
- "vfModuleLabel": "base_vmme"
+ "vfModuleLabel": "base_vflorence"
},
"inputs": {}
}
"modelCustomizationName": "ExtVL 0"
}
},
- "collectionResource": {},
+ "collectionResources": {},
"configurations": {
"Port Mirroring Configuration By Policy 0": {
"uuid": "b4398538-e89d-4f13-b33d-ca323434ba50",
},
"serviceProxies": {},
"vfModules": {
- "vf_vmee0..VfVmee..vmme_vlc..module-1": {
+ "vf_vgeraldine0..VfVgeraldine..vflorence_vlc..module-1": {
"uuid": "522159d5-d6e0-4c2a-aa44-5a542a12a830",
"invariantUuid": "98a7c88b-b577-476a-90e4-e25a5871e02b",
"customizationUuid": "55b1be94-671a-403e-a26c-667e9c47d091",
"description": null,
- "name": "VfVmee..vmme_vlc..module-1",
+ "name": "VfVgeraldine..vflorence_vlc..module-1",
"version": "2",
- "modelCustomizationName": "VfVmee..vmme_vlc..module-1",
+ "modelCustomizationName": "VfVgeraldine..vflorence_vlc..module-1",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "vmme_vlc"
+ "vfModuleLabel": "vflorence_vlc"
},
"inputs": {},
"volumeGroupAllowed": true
},
- "vf_vmee0..VfVmee..vmme_gpb..module-2": {
+ "vf_vgeraldine0..VfVgeraldine..vflorence_gpb..module-2": {
"uuid": "41708296-e443-4c71-953f-d9a010f059e1",
"invariantUuid": "1cca90b8-3490-495e-87da-3f3e4c57d5b9",
"customizationUuid": "6add59e0-7fe1-4bc4-af48-f8812422ae7c",
"description": null,
- "name": "VfVmee..vmme_gpb..module-2",
+ "name": "VfVgeraldine..vflorence_gpb..module-2",
"version": "2",
- "modelCustomizationName": "VfVmee..vmme_gpb..module-2",
+ "modelCustomizationName": "VfVgeraldine..vflorence_gpb..module-2",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "vmme_gpb"
+ "vfModuleLabel": "vflorence_gpb"
},
"inputs": {},
"volumeGroupAllowed": false
},
- "vf_vmee0..VfVmee..base_vmme..module-0": {
+ "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0": {
"uuid": "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
"invariantUuid": "a6f9e51a-2b35-416a-ae15-15e58d61f36d",
"customizationUuid": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
"description": null,
- "name": "VfVmee..base_vmme..module-0",
+ "name": "VfVgeraldine..base_vflorence..module-0",
"version": "2",
- "modelCustomizationName": "VfVmee..base_vmme..module-0",
+ "modelCustomizationName": "VfVgeraldine..base_vflorence..module-0",
"properties": {
"minCountInstances": 1,
"maxCountInstances": 1,
"initialCount": 1,
- "vfModuleLabel": "base_vmme"
+ "vfModuleLabel": "base_vflorence"
},
"inputs": {},
"volumeGroupAllowed": true
}
},
"volumeGroups": {
- "vf_vmee0..VfVmee..base_vmme..module-0": {
+ "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0": {
"uuid": "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
"invariantUuid": "a6f9e51a-2b35-416a-ae15-15e58d61f36d",
"customizationUuid": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
"description": null,
- "name": "VfVmee..base_vmme..module-0",
+ "name": "VfVgeraldine..base_vflorence..module-0",
"version": "2",
- "modelCustomizationName": "VfVmee..base_vmme..module-0",
+ "modelCustomizationName": "VfVgeraldine..base_vflorence..module-0",
"properties": {
"minCountInstances": 1,
"maxCountInstances": 1,
"initialCount": 1,
- "vfModuleLabel": "base_vmme"
+ "vfModuleLabel": "base_vflorence"
},
"inputs": {}
}
"6e59c5de-f052-46fa-aa7e-2fca9d674c44": {
"networks": {},
"vnfs": {
- "VF_vMee 0": {
+ "VF_vGeraldine 0": {
"rollbackOnFailure": "true",
"vfModules": {
- "vf_vmee0..VfVmee..base_vmme..module-0": {
- "vf_vmee0..VfVmee..base_vmme..module-0vmvzo": {
+ "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0": {
+ "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0vmvzo": {
"isMissingData": false,
"sdncPreReload": null,
"modelInfo": {
"modelType": "VFmodule",
"modelInvariantId": "a6f9e51a-2b35-416a-ae15-15e58d61f36d",
"modelVersionId": "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
- "modelName": "VfVmee..base_vmme..module-0",
+ "modelName": "VfVgeraldine..base_vflorence..module-0",
"modelVersion": "2",
"modelCustomizationId": "f8c040f1-7e51-4a11-aca8-acf256cfd861",
- "modelCustomizationName": "VfVmee..base_vmme..module-0"
+ "modelCustomizationName": "VfVgeraldine..base_vflorence..module-0"
},
"instanceParams": [
{}
}
},
"isMissingData": true,
- "originalName": "VF_vMee 0",
- "vnfStoreKey": "VF_vMee 0",
+ "originalName": "VF_vGeraldine 0",
+ "vnfStoreKey": "VF_vGeraldine 0",
"trackById": "p3wk448m5do",
"uuid": "d6557200-ecf2-4641-8094-5393ae3aae60",
"productFamilyId": "36b4733a-53f4-4cc8-8ff0-9172e5fc4b8e",
"modelType": "VF",
"modelInvariantId": "4160458e-f648-4b30-a176-43881ffffe9e",
"modelVersionId": "6e59c5de-f052-46fa-aa7e-2fca9d674c44",
- "modelName": "VF_vMee",
+ "modelName": "VF_vGeraldine",
"modelVersion": "2.0",
- "modelCustomizationName": "VF_vMee 0"
+ "modelCustomizationName": "VF_vGeraldine 0"
}
}
},
"lcpRegionsAndTenants": {
"lcpRegionList": [
{
- "id": "JANET25",
- "name": "JANET25",
+ "id": "AAIAIC25",
+ "name": "AAIAIC25",
"isPermitted": true
},
{
}
],
"lcpRegionsTenantsMap": {
- "JANET25": [
+ "AAIAIC25": [
{
"id": "092eb9e8e4b7412e8787dd091bc58e86",
"name": "USP-SIP-IC-24335-T-01",
"productFamilies": [
{
"id": "ebc3bc3d-62fd-4a3f-a037-f619df4ff034",
- "name": "SCOTTIE",
+ "name": "ERICA",
"isPermitted": true
},
{
},
{
"id": "323d69d9-2efe-4r45-ay0a-89ea7ard4e6f",
- "name": "vSCP",
+ "name": "vEsmeralda",
"isPermitted": true
},
{
"isPermitted": true
},
{
- "id": "Cisneros",
+ "id": "vMuriel",
"name": "vMuriel",
"isPermitted": true
},
},
{
"id": "d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4",
- "name": "Josefina",
+ "name": "JOSEFINA",
"isPermitted": true
},
{
},
{
"id": "6",
- "name": "vSEGW",
+ "name": "vPorfirio",
"isPermitted": false
},
{
},
{
"id": "9",
- "name": "vMME",
+ "name": "vFLORENCE",
"isPermitted": false
},
{
},
{
"id": "11",
- "name": "vSCP",
+ "name": "vEsmeralda",
"isPermitted": false
},
{
},
{
"id": "13",
- "name": "vMMSC",
+ "name": "vWINIFRED",
"isPermitted": false
},
{
let injector;
let service: VfModuleControlGenerator;
let httpMock: HttpTestingController;
+ let store : NgRedux<AppState>;
+ let mockFeatureFlagsService: FeatureFlagsService = mock(FeatureFlagsService);
+
beforeAll(done => (async () => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [VfModuleControlGenerator,
GenericFormService,
- BasicControlGenerator,
+ SharedControllersService,
+ ControlGeneratorUtil,
AaiService,
FormBuilder,
LogService,
- {provide:FeatureFlagsService, useClass: MockFeatureFlagsService},
+ SharedTreeService,
+ {provide: FeatureFlagsService, useValue: instance(mockFeatureFlagsService)},
{provide: NgRedux, useClass: MockAppStore}]
});
await TestBed.compileComponents();
injector = getTestBed();
service = injector.get(VfModuleControlGenerator);
httpMock = injector.get(HttpTestingController);
+ store = injector.get(NgRedux);
jest.spyOn(console, 'error');
})().then(done).catch(done.fail));
+ let formControlsWithoutLcpRegionTenantLegacy : string[] =
+ [FormControlNames.INSTANCE_NAME,
+ FormControlNames.VOLUME_GROUP_NAME,
+ FormControlNames.ROLLBACK_ON_FAILURE,
+ SDN_C_PRE_LOAD,];
+
+ let formControlsWithLcpRegionTenantLegacy : string[] =
+ [FormControlNames.INSTANCE_NAME,
+ FormControlNames.VOLUME_GROUP_NAME,
+ FormControlNames.LCPCLOUD_REGION_ID,
+ FormControlNames.LEGACY_REGION,
+ FormControlNames.TENANT_ID,
+ FormControlNames.ROLLBACK_ON_FAILURE,
+ SDN_C_PRE_LOAD,];
+
+
+
test(' getMacroFormControls gets vnfStoreKey === null', () => {
const serviceId: string = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
const vnfStoreKey: string = null;
- const vfModuleStoreKey: string = 'vf_vmee0..VfVmee..base_vmme..module-0';
+ const vfModuleStoreKey: string = 'vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0';
const vfModuleUUID: string = "522159d5-d6e0-4c2a-aa44-5a542a12a830";
const controls: FormControlModel[] = service.getMacroFormControls(serviceId, vnfStoreKey, vfModuleStoreKey, vfModuleUUID, true);
test('getAlaCarteFormControls check for mandatory controls', () => {
const serviceId: string = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
- const vnfStoreKey: string = 'VF_vMee 0';
- const vfModuleStoreKey: string = 'vf_vmee0..VfVmee..base_vmme..module-0';
+ const vnfStoreKey: string = 'VF_vGeraldine 0';
+ const vfModuleStoreKey: string = 'vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0';
const uuidData: Object = {
modelId : "522159d5-d6e0-4c2a-aa44-5a542a12a830",
- modelName : "vf_vmee0..VfVmee..base_vmme..module-0",
+ modelName : "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0",
serviceId : "6e59c5de-f052-46fa-aa7e-2fca9d674c44",
type : "VFmodule",
- vFModuleStoreKey : "vf_vmee0..VfVmee..base_vmme..module-0vmvzo",
- vnfStoreKey : "VF_vMee 0"
+ vFModuleStoreKey : "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0vmvzo",
+ vnfStoreKey : "VF_vGeraldine 0"
};
const controls: FormControlModel[] = service.getAlaCarteFormControls(serviceId, vnfStoreKey, vfModuleStoreKey, uuidData, true);
}
});
+
+ const cases = [
+ [true, true, true, null, true, true],
+ [true, true, false, null, true, false], //Scenario to check that UI field doesn't appear.
+ [false, true, false, "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0_vol", true, true],
+ [false, true, true, "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0_vol", true, true],
+ [false, false, true, null, false, false],
+ ];
+
+ test.each(cases)('Given Ecomp Gen Name: %p and VG Name %p , ' +
+ 'is A La Carte %p - expect the name value for VG to be %p , ' +
+ 'VG Name should be defined: %p , and should the field be visible: %p',
+ (ecomGenName, vGName, isALaCarte, expectedName, shouldWeVerifyDefinitionOfField, isVisible) => {
+ const moduleName = "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0";
+ service.vfModuleModel = new VfModule();
+ service.vfModuleModel.name = moduleName;
+ service.vfModuleModel.volumeGroupAllowed = vGName;
+ let vnf : Object = {isEcompGeneratedNaming: ecomGenName};
+ const serviceId: string = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
+ const vnfStoreKey: string = 'VF_vGeraldine 0';
+ const uuidData: Object = {
+ modelName : moduleName,
+ vFModuleStoreKey : "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0vmvzo",
+ };
+ const vfModuleModel :VfModuleInstance = service.getVfModuleInstance(serviceId, vnfStoreKey, uuidData,true);
+ let existingMatchingFieldInForm = buildVfModuleFormControlModel(vfModuleModel ,serviceId, vnf, isALaCarte);
+ if (shouldWeVerifyDefinitionOfField) {
+ expect(existingMatchingFieldInForm).toBeDefined();
+ expect(existingMatchingFieldInForm.value).toEqual(expectedName);
+ expect(existingMatchingFieldInForm.isVisible).toEqual(isVisible);
+ } else {
+ expect(existingMatchingFieldInForm).toBeUndefined();
+ }
+ });
+
+ let buildVfModuleFormControlModel = function(vfModuleModel :any, serviceId: string, vnf, isALaCarte) :FormControlModel {
+ let controls: FormControlModel[] = service.pushInstanceAndVGToForm([], vfModuleModel, serviceId, vnf, isALaCarte);
+ return controls.find(ctrl => ctrl.controlName === FormControlNames.VOLUME_GROUP_NAME);
+ };
+
test('getMacroFormControls check for mandatory controls', () => {
const serviceId: string = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
- const vnfStoreKey: string = 'VF_vMee 0';
+ const vnfStoreKey: string = 'VF_vGeraldine 0';
const uuidData: Object = {
modelId : "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
- modelName : "vf_vmee0..VfVmee..base_vmme..module-0",
+ modelName : "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0",
serviceId : "6e59c5de-f052-46fa-aa7e-2fca9d674c44",
type : "VFmodule",
- vFModuleStoreKey : "vf_vmee0..VfVmee..base_vmme..module-0vmvzo",
- vnfStoreKey : "VF_vMee 0"
+ vFModuleStoreKey : "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0vmvzo",
+ vnfStoreKey : "VF_vGeraldine 0"
};
const controls: FormControlModel[] = service.getMacroFormControls(serviceId, vnfStoreKey, vnfStoreKey, uuidData, true);
expect(console.error).toHaveBeenCalled();
});
- test('getAlaCarteFormControls should return the correct order of controls', () => {
+ each([
+ [true, 5, formControlsWithoutLcpRegionTenantLegacy],
+ [false, 8,formControlsWithLcpRegionTenantLegacy]
+ ]).
+ test('getAlaCarteFormControls should return the correct order of controls', (flag: boolean, controlAmount: number, orderedControls: string[]) => {
+ when(mockFeatureFlagsService.getFlagState(Features.FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF)).thenReturn(flag);
const controls:FormControlModel[] = getAlaCarteFormControls();
- const orderedControls : string[] = [
- FormControlNames.INSTANCE_NAME,
- FormControlNames.VOLUME_GROUP_NAME,
- FormControlNames.LCPCLOUD_REGION_ID,
- FormControlNames.LEGACY_REGION,
- FormControlNames.TENANT_ID,
- FormControlNames.ROLLBACK_ON_FAILURE,
- FormControlNames.SDN_C_PRE_LOAD
- ];
-
- expect(controls.length).toEqual(7);
+ expect(controls.length).toEqual(controlAmount);
for(let i = 0 ; i < orderedControls.length ; i++) {
expect(controls[i].controlName).toEqual(orderedControls[i]);
}
function getAlaCarteFormControls():FormControlModel[] {
const serviceId: string = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
- const vnfStoreKey: string = 'VF_vMee 0';
+ const vnfStoreKey: string = 'VF_vGeraldine 0';
const vfModuleUUID: string = "522159d5-d6e0-4c2a-aa44-5a542a12a830";
const uuidData: Object = {
modelId: "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
- modelName: "vf_vmee0..VfVmee..base_vmme..module-0",
+ modelName: "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0",
serviceId: "6e59c5de-f052-46fa-aa7e-2fca9d674c44",
type: "VFmodule",
- vFModuleStoreKey: "vf_vmee0..VfVmee..base_vmme..module-0vmvzo",
- vnfStoreKey: "VF_vMee 0"
+ vFModuleStoreKey: "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0vmvzo",
+ vnfStoreKey: "VF_vGeraldine 0"
};
const controls: FormControlModel[] = service.getAlaCarteFormControls(serviceId, vnfStoreKey, vfModuleUUID, uuidData, true);
return controls;
}
- test('getAlaCarteFormControls responce with wrong order of controls', () => {
- const controls:FormControlModel[] = getAlaCarteFormControls();
-
- const orderedControls : string[] = [
- FormControlNames.INSTANCE_NAME,
- FormControlNames.VOLUME_GROUP_NAME,
- FormControlNames.LCPCLOUD_REGION_ID,
- FormControlNames.TENANT_ID, // TENANT_ID must be after LEGACY_REGION
- FormControlNames.LEGACY_REGION,
- FormControlNames.ROLLBACK_ON_FAILURE,
- FormControlNames.SDN_C_PRE_LOAD
- ];
-
- for(let i = 0 ; i < orderedControls.length ; i++) {
- if (controls[i].controlName === 'legacyRegion') {
- expect(orderedControls[i]).toEqual('tenantId');
- }
- }
- });
-
test('getMacroFormControls should return the correct order of controls', () => {
const serviceId: string = "6e59c5de-f052-46fa-aa7e-2fca9d674c44";
- const vnfStoreKey: string = 'VF_vMee 0';
+ const vnfStoreKey: string = 'VF_vGeraldine 0';
const vfModuleUUID: string = "522159d5-d6e0-4c2a-aa44-5a542a12a830";
const uuidData: Object = {
modelId : "a27f5cfc-7f12-4f99-af08-0af9c3885c87",
- modelName : "vf_vmee0..VfVmee..base_vmme..module-0",
+ modelName : "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0",
serviceId : "6e59c5de-f052-46fa-aa7e-2fca9d674c44",
type : "VFmodule",
- vFModuleStoreKey : "vf_vmee0..VfVmee..base_vmme..module-0vmvzo",
- vnfStoreKey : "VF_vMee 0"
+ vFModuleStoreKey : "vf_vgeraldine0..VfVgeraldine..base_vflorence..module-0vmvzo",
+ vnfStoreKey : "VF_vGeraldine 0"
};
const controls: FormControlModel[] = service.getMacroFormControls(serviceId, vnfStoreKey, vfModuleUUID, uuidData, true);
expect(instanceNameValidator.validatorArg).toEqual(/^[a-zA-Z0-9._-]*$/);
});
- test(' getAlaCarteFormControls gets null service', () => {
- const controls:FormControlModel[] = getAlaCarteFormControls();
- expect(controls.length).toEqual(7);
- const orderedControls : string[] = [
- FormControlNames.INSTANCE_NAME,
- FormControlNames.VOLUME_GROUP_NAME,
- FormControlNames.LCPCLOUD_REGION_ID,
- FormControlNames.LEGACY_REGION,
- FormControlNames.TENANT_ID,
- FormControlNames.ROLLBACK_ON_FAILURE,
- FormControlNames.SDN_C_PRE_LOAD
- ];
+ test('when flag is active - response should contains upload file', ()=>{
+ spyOn(store, 'getState').and.returnValue( {
+ "global": {
+ "flags": {
+ "FLAG_2006_VFM_SDNC_PRELOAD_FILES" : true
+ }
+ }
+ });
+
+ const extraContent = service.getSdncExtraContents();
+ console.log("extraContent", extraContent);
+ const uploadFileData = <any>extraContent[0];
+
+ expect(uploadFileData.type).toEqual('UPLOAD_FILE');
+ expect(uploadFileData.dataTestId).toEqual('sdnc_pereload_upload_link');
+ expect(uploadFileData.uploadMethod).toBeDefined();
+ expect(uploadFileData.isDisabled).toBeDefined();
+ expect(uploadFileData.onSuccess).toBeDefined();
+ expect(uploadFileData.onFailed).toBeDefined();
+
+ })
- for(let i = 0 ; i < orderedControls.length ; i++) {
- expect(controls[i].controlName).toEqual(orderedControls[i]);
- }
- });
});