wrote test case for run-report comp 90/104890/1
authorRupinder <rupinsi1@in.ibm.com>
Wed, 1 Apr 2020 15:56:46 +0000 (21:26 +0530)
committerRupinder <rupinsi1@in.ibm.com>
Wed, 1 Apr 2020 15:56:54 +0000 (21:26 +0530)
Added test case for run-report.component.spec.ts

Issue-ID: PORTAL-834
Change-Id: I40b2232953011210187a87fd2a6911a4b379d524
Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
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 509aa82..a41b11c 100644 (file)
@@ -12,6 +12,7 @@ import { RouterTestingModule } from '@angular/router/testing';
 import { RunService } from '../run.service';
 import 'rxjs/add/observable/empty';
 import 'rxjs/add/observable/of';
+import { Observable } from 'rxjs';
 
 describe('RunReportComponent', () => {
   let component: RunReportComponent;
@@ -25,6 +26,12 @@ describe('RunReportComponent', () => {
   let dashboard; 
   let dashboard2; 
   let responseformfield = 1;
+  let environment = [
+    {
+      baseUrl: 'just a link'
+    }
+  ]
+
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
@@ -42,6 +49,9 @@ describe('RunReportComponent', () => {
       providers: [RunService]
     }).compileComponents();
     runService = TestBed.get(RunService);
+    //spyOn(runService, 'getReportDataWithFormFields').and.returnValue(Observable.of(environment));
+    //spyOn(runService, 'getReportData').and.returnValue(Observable.of(environment));
+    spyOn(runService, 'downloadReportExcel').and.returnValue(Observable.of(environment));
   }));
 
   beforeEach(() => {
@@ -125,7 +135,9 @@ describe('RunReportComponent', () => {
   });
 
   it('should test downloadReportExcel method', () => {
+    spyOn(component, 'downloadReportExcel').and.callThrough();
         component.downloadReportExcel();
+        expect(component.downloadReportExcel).toHaveBeenCalled();
   });
 
   it('should test applyFilter method', () => {
@@ -150,5 +162,26 @@ describe('RunReportComponent', () => {
         expect(component.NEWdisplayedColumns).toEqual(new Array());
         expect(component.isReady).toEqual(false);
   });
+
+   it('should test initialProcess method', () => {
+      component.DashboardReportObj.length = 1;
+      component.initialProcesses();
+  });
+
+  // it('should test postFetchingReportDataFn method', () => {
+  //     let response: any;
+  //     component.postFetchingReportDataFn(response);
+  // })
+
+  // it('should test ngOnChanges subscribe method', ()  => {
+  //     spyOn(component, 'ngOnChanges').and.callThrough();
+  //     component.ngOnChanges(change);
+  //     expect(component.ngOnChanges).toHaveBeenCalled();
+  // })
+
+  // it('should test postFetchingReportDataFn method', () => {
+  //   let obj: any;
+  //     component.postFetchingReportDataFn(obj);
+  // })
   
 });