diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-04-28 20:37:30 +0530 |
---|---|---|
committer | Indrijeet kumar <indriku1@in.ibm.com> | 2020-04-28 20:37:36 +0530 |
commit | 60405f0659677821dad359344d7105d1455593ea (patch) | |
tree | 16568e4a4c0971f72efc07cdf0af0a5194a9727b /ecomp-sdk/epsdk-app-overlay/src | |
parent | db6c63ebfcce75b364ac46fbf66d800aab2fa652 (diff) |
test cases in run-report-result-set comp
test cases in run-report-result-set component
Issue-ID: PORTAL-813
Change-Id: Ic6f62c100191232c65164c5ed093caa86a5d8485
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts index 44765d49..fa856c00 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-result-set/run-report-result-set.component.spec.ts @@ -6,12 +6,21 @@ import { MatTableModule } from '@angular/material/table'; import { RunReportResultSetComponent } from './run-report-result-set.component'; import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { HttpClient } from '@angular/common/http'; import { RouterTestingModule } from '@angular/router/testing'; +import { RunService } from '../run.service'; +import 'rxjs/add/observable/of'; +import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/operator/catch'; +import 'rxjs/add/observable/throw'; describe('RunReportResultSetComponent', () => { let component: RunReportResultSetComponent; let fixture: ComponentFixture<RunReportResultSetComponent>; + let _runService:RunService; + var response={ + "reportDataColumns":[{"columnTitle":"columnTitle"}], + "reportDataRows":[{"colId":"colId"}] + } beforeEach(async(() => { TestBed.configureTestingModule({ @@ -31,9 +40,26 @@ describe('RunReportResultSetComponent', () => { fixture = TestBed.createComponent(RunReportResultSetComponent); component = fixture.componentInstance; fixture.detectChanges(); + _runService=TestBed.get(RunService); }); it('should compile', () => { expect(component).toBeTruthy(); }); + + it('should test ngOnInit method',()=>{ + component.reportId1="reportId1"; + let spy=spyOn(_runService,'getReportData').and.returnValue(Observable.of(response)); + component.ngOnInit(); + expect(spy).toHaveBeenCalled(); + + }) + + it('should test ngAfterViewInit method',()=>{ + component.reportId1="reportId1"; + let spy=spyOn(_runService,'getReportData').and.returnValue(Observable.of(response)) + component.ngAfterViewInit(); + expect(spy).toHaveBeenCalled(); + }) + }); |