From 07178dd3c0419a15af7e3dd47967621ab8c8bb5f Mon Sep 17 00:00:00 2001 From: "IBM602-PC0F1E3C\\Arundathi" Date: Fri, 13 Jul 2018 15:25:51 +0530 Subject: wrote unit test case for parameter component. Added unit test cases to cover ngOninit, selectedNavItem and showUpload methods. Issue-ID: APPC-1064 Change-Id: I38b885f905a13ca316ee31e5efa6b5bbb74d8506 Signed-off-by: Arundathi --- .../parameter.component.spec.ts | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/app/vnfs/build-artifacts/parameter-definitions') diff --git a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.spec.ts b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.spec.ts index 7e248e3..d539d6a 100644 --- a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.spec.ts +++ b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.spec.ts @@ -2,6 +2,8 @@ ============LICENSE_START========================================== =================================================================== Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. + +Copyright (C) 2018 IBM Intellectual Property. All rights reserved. =================================================================== Unless otherwise specified, all software contained herein is licensed @@ -97,6 +99,28 @@ describe('ParameterComponent', () => { expect(component).toBeTruthy(); }); + it('should call ngOnInit...', inject([MappingEditorService, ParamShareService], (mappingEditorService: MappingEditorService, paramShareService:ParamShareService) => { + + mappingEditorService.latestAction = {"action":"Configure","action-level":"vnf","scope":{"vnf-type":"ticktack","vnfc-type":""},"template":"Y","vm":[],"device-protocol":"CHEF","user-name":"","port-number":"","artifact-list":[{"artifact-name":"template_Configure_ticktack_0.0.1V.json","artifact-type":"config_template"},{"artifact-name":"pd_Configure_ticktack_0.0.1V.yaml","artifact-type":"parameter_definitions"}],"scopeType":"vnf-type"}; + mappingEditorService.appDataObject = {"value" : ''}; + mappingEditorService.downloadDataObject = {"value": ''}; + mappingEditorService.identifier = "identifier"; + component.ngOnInit(); + + })); + + it('should test selectedNavItem method...', () => { + component.selectedNavItem('item'); + expect(component.item).toEqual('item'); + }); + + it('should set the selectedUploadType value', ()=>{ + let obj = {value : 'type1', display : 'display1'}; + component.uploadTypes = [obj]; + component.showUpload(); + expect(component.selectedUploadType.toString()).toEqual("type1"); + }); + it('should retrieve PD from APPC...', () => { expect(component.getPD()); -- cgit 1.2.3-korg