aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.spec.ts
blob: 8675d36f2f1ed844610a290294dc0355b78ca410 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import {ComponentInfoService} from "../../../component-info/component-info.service";
import {AppState} from "../../../../../shared/store/reducers";
import {NgRedux} from "@angular-redux/store";
import {PnfModelInfo} from "./pnf.model.info";
import {getTestBed, TestBed} from "@angular/core/testing";
import {DynamicInputsService} from "../../dynamicInputs.service";
import {SharedTreeService} from "../../shared.tree.service";
import {DuplicateService} from "../../../duplicate/duplicate.service";
import {AaiService} from "../../../../../shared/services/aaiService/aai.service";
import {FeatureFlagsService} from "../../../../../shared/services/featureFlag/feature-flags.service";
import {IframeService} from "../../../../../shared/utils/iframe.service";
import {HttpClientTestingModule} from "@angular/common/http/testing";
import {MockNgRedux, NgReduxTestingModule} from "@angular-redux/store/testing";
import {HttpClient, HttpHandler} from "@angular/common/http";
import {CollectionResourceModel} from "../../../../../shared/models/collectionResourceModel";
import {ComponentInfoType} from "../../../component-info/component-info-model";
import {VNFModel} from "../../../../../shared/models/vnfModel";
import {PNFModel} from "../../../../../shared/models/pnfModel";


describe('PNF model info', () => {
  let injector;
  let _componentInfoService: ComponentInfoService;
  let _store: NgRedux<AppState>;
  let _sharedTreeService;
  let pnfModel: PnfModelInfo;
  beforeEach(done => (async () => {
    TestBed.configureTestingModule({
      imports: [HttpClientTestingModule, NgReduxTestingModule],
      providers: [
        MockNgRedux,
        DynamicInputsService,
        SharedTreeService,
        DuplicateService,
        AaiService,
        HttpClient,
        HttpHandler,
        FeatureFlagsService,
        ComponentInfoService,
        IframeService]
    });
    await TestBed.compileComponents();
    injector = getTestBed();
    _store = injector.get(NgRedux);
    _sharedTreeService = injector.get(SharedTreeService);
    pnfModel = new PnfModelInfo(_sharedTreeService);
    _componentInfoService = injector.get(ComponentInfoService);
  })().then(done).catch(done.fail));

  test('pnf model should be defined', () => {
    expect(pnfModel).toBeDefined();
  });

  test('pnf model should defined extra details', () => {
    expect(pnfModel.name).toEqual('pnfs');
    expect(pnfModel.type).toEqual('PNF');
    expect(pnfModel.typeName).toEqual('PNF');
    expect(pnfModel.componentInfoType).toEqual(ComponentInfoType.PNF);
  });

  test('getTooltip should return "PNF"', () => {
    let tooltip: string = pnfModel.getTooltip();
    expect(tooltip).toEqual('PNF');
  });

  test('getType should return "pnf"', () => {
    let tooltip: string = pnfModel.getType();
    expect(tooltip).toEqual('pnf');
  });

  test('getNextLevelObject should be null', () => {
    let nextLevel: any = pnfModel.getNextLevelObject();
    expect(nextLevel).toBeNull();
  });

  test('isEcompGeneratedNaming should return false', () => {
    let isEcompGeneratedNaming: boolean = pnfModel.isEcompGeneratedNaming(<any>{});
    expect(isEcompGeneratedNaming).toBeFalsy();
  });

  test('getModel should return pnf model', () => {
    expect(pnfModel.getModel({})).toBeInstanceOf(PNFModel);
  });

})