Template Configuration componnet spec fix 00/93400/1
authorArundathi Patil <arundpil@in.ibm.com>
Tue, 13 Aug 2019 09:47:57 +0000 (15:17 +0530)
committerArundathi Patil <arundpil@in.ibm.com>
Tue, 13 Aug 2019 09:48:06 +0000 (15:18 +0530)
Fixed multpile errors in spec file

Issue-ID: APPC-1632
Change-Id: I38458db9dcd5a7ee95eed7f82a0e4c5fe36fa579
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.spec.ts

index 8c0ca77..d96519a 100644 (file)
@@ -57,6 +57,8 @@ import { NgProgress } from 'ngx-progressbar';
 import { BaseRequestOptions, Response, ResponseOptions, Http } from '@angular/http';
 import { MockBackend, MockConnection } from '@angular/http/testing';
 import { UtilityService } from '../../../../shared/services/utilityService/utility.service';
+import { APIService } from "../../../../shared/services/cdt.apicall";
+import { ProcOnSrvSideSvc } from "../../../../shared/services/procOnSrvSide.service";
 
 describe('GoldenConfigurationComponent', () => {
   let component: GoldenConfigurationComponent;
@@ -101,7 +103,7 @@ describe('GoldenConfigurationComponent', () => {
     TestBed.configureTestingModule({
       imports: [FormsModule, BrowserModule, RouterTestingModule.withRoutes(routes), HttpModule, Ng2Bs3ModalModule, SimpleNotificationsModule.forRoot()],
       declarations: [GoldenConfigurationComponent, HomeComponent, TestComponent, HelpComponent, AboutUsComponent, LogoutComponent, AceEditorComponent],
-      providers: [BuildDesignComponent, NgProgress, ParamShareService, DialogService, NotificationService, NgxSpinnerService, MockBackend,
+      providers: [ProcOnSrvSideSvc, APIService, BuildDesignComponent, NgProgress, ParamShareService, DialogService, NotificationService, NgxSpinnerService, MockBackend,
         BaseRequestOptions, UtilityService,
         {
           provide: Http,
@@ -132,10 +134,33 @@ describe('GoldenConfigurationComponent', () => {
   });
 
 
-  it('validate initialisation of variables in ngOnit() function', inject([MappingEditorService], (mappingEditorService: MappingEditorService) => {
+  fit('validate initialisation of variables in ngOnit() function', inject([MappingEditorService], (mappingEditorService: MappingEditorService) => {
     fixture = TestBed.createComponent(GoldenConfigurationComponent);
     component = fixture.componentInstance;
-    mappingEditorService.latestAction = { "action": "Configure", "action-level": "vnf", "scope": { "vnf-type": "testVnf", "vnfc-type": "" }, "template": "Y", "vm": [], "device-protocol": "CHEF", "user-name": "", "port-number": "", "artifact-list": [{ "artifact-name": "template_Configure_test_0.0.1V.json", "artifact-type": "config_template" }, { "artifact-name": "pd_Configure_test_0.0.1V.yaml", "artifact-type": "parameter_definitions" }], "scopeType": "vnf-type" }
+    mappingEditorService.newObject = {
+      "action": "Configure",
+      "action-level": "vnf",
+      "scope": { "vnf-type": "testVnf", "vnfc-type": "" },
+      "template": "Y",
+      "vm": [],
+      "device-protocol":
+        "CHEF",
+      "user-name": "",
+      "port-number": "",
+      "artifact-list": [{
+        "artifact-name": "template_Configure_test_0.0.1V.json",
+        "artifact-type": "config_template"
+      },
+      {
+        "artifact-name": "pd_Configure_test_0.0.1V.yaml",
+        "artifact-type": "parameter_definitions"
+      }],
+      "scopeType": "vnf-type",
+      "vnf": "testVnf",
+      "vnfc": "",
+      "protocol": "CHEF",
+      "template_artifact": "template_Configure_test_0.0.1V.json"
+    }
 
     expect(component.ngOnInit());
     expect(component.ngAfterViewInit());
@@ -143,14 +168,7 @@ describe('GoldenConfigurationComponent', () => {
     expect(component.vnfType).toEqual('testVnf');
     expect(component.vnfcType).toEqual('');
     expect(component.protocol).toEqual('CHEF');
-
     expect(component.artifactName).toEqual('template_Configure_test_0.0.1V.json');
-
-    mappingEditorService.latestAction = { "action": "Configure", "action-level": "vnf", "scope": { "vnf-type": "testVnf", "vnfc-type": "testVnfc" }, "template": "Y", "vm": [], "device-protocol": "CHEF", "user-name": "", "port-number": "", "artifact-list": [{ "artifact-name": "template_Configure_test_0.0.1V.json", "artifact-type": "config_template" }, { "artifact-name": "pd_Configure_test_0.0.1V.yaml", "artifact-type": "parameter_definitions" }], "scopeType": "vnf-type" }
-    expect(component.ngOnInit());
-    expect(component.vnfcType).toEqual('testVnfc');
-
-
   }));
 
   it('check if variables are empty when reference data object is empty', inject([MappingEditorService], (mappingEditorService: MappingEditorService) => {