diff options
author | Lorraine Welch <lb2391@att.com> | 2020-04-29 10:51:52 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-29 10:51:52 +0000 |
commit | 30df76c9c99eea33950d96256fae80fa80a071a7 (patch) | |
tree | 733bcc779d9f6bae4084096bb83ab79436609318 | |
parent | d9e0ea414c448a37d3b6efb7b46b648739a4c8a5 (diff) | |
parent | 60405f0659677821dad359344d7105d1455593ea (diff) |
Merge "test cases in run-report-result-set comp"
-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(); + }) + }); |