Added test case for run-report component 04/100804/1
authorRupinder <rupinsi1@in.ibm.com>
Mon, 27 Jan 2020 10:50:53 +0000 (16:20 +0530)
committerRupinder <rupinsi1@in.ibm.com>
Mon, 27 Jan 2020 10:52:18 +0000 (16:22 +0530)
Written test cases for run-report component and made some changes in
form-field component

Issue-ID: PORTAL-808
Change-Id: I41a01b76c325e04efa509e47d30716e5a7b4cb65
Signed-off-by: Rupinder <rupinsi1@in.ibm.com>
ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts
ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts

index eeb76e2..f491f37 100644 (file)
@@ -3,11 +3,11 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 import { FormFieldsComponent } from './form-fields.component';
 
 describe('FormFieldsComponent', () => {
-  let component: FormFieldsComponent;
+  let component: FormFieldsComponent;    
   let fixture: ComponentFixture<FormFieldsComponent>;
-
+                                     
   beforeEach(async(() => {
-    TestBed.configureTestingModule({
+    TestBed.configureTestingModule({    
       declarations: [ FormFieldsComponent ]
     })
     .compileComponents();
@@ -25,26 +25,26 @@ describe('FormFieldsComponent', () => {
 
   it('should test ngOnInit function', () => {
     component.ngOnInit();
-  })
+  });
 
   it('should test isLast functions', () =>{
     component.formFieldsListObj = [1,2,3,4,5];
     let test: Boolean =  component.isLast(3);
     expect(test).toEqual(false);
-  })
+  });
 
   it('should test isFirst function', () => {
     let test: Boolean = component.isFirst(0);
     expect(test).toEqual(true);
-  })
+  });
 
   it('should test ngDoCheck', () => {
     component.sqlAsDefaultValue = true;
     component.ngDoCheck();
     expect(component.showDefaultSQLOption).toEqual(true);    
-  })
-  
- it('should test close function', () => {
+  });
+
 it('should test close function', () => {
     component.close();
     expect(component.closable).toEqual(false);
   });
@@ -55,11 +55,12 @@ describe('FormFieldsComponent', () => {
   });
 
   it('should test openDialog method', () => {
-    expect(component.openDialog()).toHaveBeenCalled;
+    expect(component.openDialog).toHaveBeenCalled();
   });
 
   it('should test openSnackBar method', () => {
-    expect(component.openSnackBar("Just", "for testing")).toHaveBeenCalled;
+    component.openSnackBar("Just", "for testing");
+    expect(component.openSnackBar).toHaveBeenCalled();
   })
 
 });
index f1d53d9..8e77e7b 100644 (file)
@@ -31,4 +31,23 @@ describe('RunReportFinalTableComponent', () => {
   it('should compile', () => {
     expect(component).toBeTruthy();
   });
+
+ it('should  test ngOnInit method ', () => {
+      component.ngOnInit();
+      expect(component.initialProcesses()).toHaveBeenCalled();
+  });
+
+  it('should test initialProcess method', () => {
+    component.DashboardReportObj.length = 1;
+      component.initialProcesses();
+      expect(component.options.scrollSpeed).toEqual(20);
+  });
+
+  it('should test showError method', () => {
+       component.showError("abc");
+       expect(component.error).toEqual(true);
+       expect(component.showSpinner).toEqual(false);
+  })
+
+
 });