diff options
author | 2020-04-01 21:26:46 +0530 | |
---|---|---|
committer | 2020-04-01 21:26:54 +0530 | |
commit | 0bf60d188f3db03b99ecca0a4946df136c48f3b7 (patch) | |
tree | 67f187b90864b31f268889943c014356c37dac57 | |
parent | 20c95c7edd0861504b50cd86a65ce888b1c6efa6 (diff) |
wrote test case for run-report comp
Added test case for run-report.component.spec.ts
Issue-ID: PORTAL-834
Change-Id: I40b2232953011210187a87fd2a6911a4b379d524
Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts b/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 509aa82e..a41b11cd 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report/run-report.component.spec.ts @@ -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); + // }) }); |