reference-dataform.component- added test case 73/65473/1
authorArundathi Patil <arundpil@in.ibm.com>
Mon, 10 Sep 2018 08:43:16 +0000 (14:13 +0530)
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>
Mon, 10 Sep 2018 08:43:32 +0000 (14:13 +0530)
Wrote test case to test and cover displayHandleVnfc() function

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

index a3d87d2..e69b8f8 100644 (file)
@@ -47,6 +47,7 @@ describe('ReferenceDataformComponent', () => {
     let component: ReferenceDataformComponent;
     let fixture: ComponentFixture<ReferenceDataformComponent>;
     let service: MockMappingService;
+    let originalTimeout;
 
     let httpMock: HttpUtilService
     //mockingthe data for mappingEditorService
@@ -121,6 +122,8 @@ describe('ReferenceDataformComponent', () => {
     }
     class MockreferenceDataObject { }
     beforeEach(async(() => {
+        //  originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
+        //  jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
         TestBed.configureTestingModule({
             declarations: [ReferenceDataformComponent],
             schemas: [NO_ERRORS_SCHEMA],
@@ -1084,4 +1087,28 @@ describe('ReferenceDataformComponent', () => {
         expect(component.errorMessage).toBe('');
         expect(component.invalid).toBe(false);
     });
+
+    it('should test displayHideVnfc function', inject([MappingEditorService], (service: MappingEditorService) => {
+        component.referenceDataObject = {
+            action: 'ConfigScaleOut',
+            'action-level': 'vnf',
+            scope: {
+                'vnf-type': '',
+                'vnfc-type-list': ['346']
+            },
+            'template': 'Y',
+            vm: [],
+            'device-protocol': '',
+            'user-name': '',
+            'port-number': '',
+            'artifact-list': []
+        };
+        service.newObject = { vnfc: false};
+        component.displayHideVnfc();
+        expect(component.vnfcIdentifier).toBe('346');
+    }));
+
+    // afterEach(function() {
+    //     jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
+    // });
 });
\ No newline at end of file