wrote unit test case for parameter component. 75/56375/3
authorIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>
Fri, 13 Jul 2018 09:55:51 +0000 (15:25 +0530)
committerTakamune Cho <tc012c@att.com>
Mon, 16 Jul 2018 14:34:01 +0000 (14:34 +0000)
Added unit test cases to cover ngOninit, selectedNavItem and showUpload
methods.

Issue-ID: APPC-1064
Change-Id: I38b885f905a13ca316ee31e5efa6b5bbb74d8506
Signed-off-by: Arundathi <arundpil@in.ibm.com>
src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.spec.ts

index 7e248e3..d539d6a 100644 (file)
@@ -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());