1 import {ComponentInfoService} from "../../../component-info/component-info.service";
2 import {AppState} from "../../../../../shared/store/reducers";
3 import {NgRedux} from "@angular-redux/store";
4 import {PnfModelInfo} from "./pnf.model.info";
5 import {getTestBed, TestBed} from "@angular/core/testing";
6 import {DynamicInputsService} from "../../dynamicInputs.service";
7 import {SharedTreeService} from "../../shared.tree.service";
8 import {DuplicateService} from "../../../duplicate/duplicate.service";
9 import {AaiService} from "../../../../../shared/services/aaiService/aai.service";
10 import {FeatureFlagsService} from "../../../../../shared/services/featureFlag/feature-flags.service";
11 import {IframeService} from "../../../../../shared/utils/iframe.service";
12 import {HttpClientTestingModule} from "@angular/common/http/testing";
13 import {MockNgRedux, NgReduxTestingModule} from "@angular-redux/store/testing";
14 import {HttpClient, HttpHandler} from "@angular/common/http";
15 import {CollectionResourceModel} from "../../../../../shared/models/collectionResourceModel";
16 import {ComponentInfoType} from "../../../component-info/component-info-model";
19 describe('PNF model info', () => {
21 let _componentInfoService: ComponentInfoService;
22 let _store: NgRedux<AppState>;
23 let pnfModel: PnfModelInfo = new PnfModelInfo();
25 TestBed.configureTestingModule({
26 imports: [HttpClientTestingModule, NgReduxTestingModule],
38 }).compileComponents();
40 injector = getTestBed();
41 _store = injector.get(NgRedux);
42 _componentInfoService = injector.get(ComponentInfoService);
45 test('pnf model should be defined', () => {
46 expect(pnfModel).toBeDefined();
49 test('pnf model should defined extra details', () => {
50 expect(pnfModel.name).toEqual('pnfs');
51 expect(pnfModel.type).toEqual('PNF');
52 expect(pnfModel.typeName).toEqual('PNF');
53 expect(pnfModel.componentInfoType).toEqual(ComponentInfoType.PNF);
56 test('getTooltip should return "PNF"', () => {
57 let tooltip: string = pnfModel.getTooltip();
58 expect(tooltip).toEqual('PNF');
61 test('getType should return "pnf"', () => {
62 let tooltip: string = pnfModel.getType();
63 expect(tooltip).toEqual('pnf');
66 test('getNextLevelObject should be null', () => {
67 let nextLevel: any = pnfModel.getNextLevelObject();
68 expect(nextLevel).toBeNull();
71 test('isEcompGeneratedNaming should return false', () => {
72 let isEcompGeneratedNaming: boolean = pnfModel.isEcompGeneratedNaming(<any>{});
73 expect(isEcompGeneratedNaming).toBeFalsy();
76 test('getModel should return pnf model', () => {
77 let model: CollectionResourceModel = pnfModel.getModel('PNF1', <any>{
79 }, getServiceHierarchy());
80 expect(model.type).toEqual('PNF');
83 function getServiceHierarchy(){
86 "uuid": "12550cd7-7708-4f53-a09e-41d3d6327ebc",
87 "invariantUuid": "561faa57-7bbb-40ec-a81c-c0d4133e98d4",
88 "name": "AIM Transport SVC_ym161f",
90 "toscaModelURL": null,
91 "category": "Network L1-3",
92 "serviceType": "TRANSPORT",
94 "description": "AIM Transport service",
95 "serviceEcompNaming": "true",
96 "instantiationType": "Macro",
99 "instantiationUI": "legacy",
100 "modelCategory": "other",
101 "viewEditUI": "legacy"
106 "collectionResources": {},
107 "configurations": {},
108 "fabricConfigurations": {},
109 "serviceProxies": {},
114 "uuid": "1c831fa9-28a6-4778-8c1d-80b9e769f2ed",
115 "invariantUuid": "74e13a12-dac9-4fba-b102-cd242d9e7f02",
116 "description": "AIM Transport service",
117 "name": "AIM PNF Model",
119 "customizationUuid": "dce78da7-c842-47a1-aba2-2de1cd03ab7a",
123 "nf_function": "SDNGW",
125 "ecomp_generated_naming": "false",