From 4aa4f18cf6bdcad77e7353e17d81b67e5873b5a8 Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Tue, 13 Aug 2019 15:17:57 +0530 Subject: Template Configuration componnet spec fix Fixed multpile errors in spec file Issue-ID: APPC-1632 Change-Id: I38458db9dcd5a7ee95eed7f82a0e4c5fe36fa579 Signed-off-by: Arundathi Patil --- .../template-configuration.component.spec.ts | 38 ++++++++++++++++------ 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.spec.ts b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.spec.ts index 8c0ca77..d96519a 100644 --- a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.spec.ts +++ b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.spec.ts @@ -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) => { -- cgit 1.2.3-korg