diff options
author | Lorraine Welch <lb2391@att.com> | 2020-04-01 13:51:11 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-01 13:51:11 +0000 |
commit | 6ee087b36fd8bbee66e6949d4b0070c1c11fb01a (patch) | |
tree | ff91fa735078640392089184e3c644e606f928b3 /ecomp-sdk/epsdk-app-overlay | |
parent | bb9994e1675578b5662cfcfa400c196e19beaae2 (diff) | |
parent | c2e11a10dd1de0c6370576293ecf7e5a3cd470b2 (diff) |
Merge "added test cases for report-list comp"
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts index 2c01ff14..78113e42 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts @@ -3,17 +3,27 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { MatPaginatorModule } from '@angular/material/paginator'; import { MatSortModule } from '@angular/material/sort'; import { MatTableModule, MatTableDataSource } from '@angular/material/table'; - import { ReportListComponent } from './report-list.component'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { Router } from '@angular/router'; import { AllReportsDataSource } from './report-list-datasource'; +import { HttpClient } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import 'rxjs/add/observable/empty'; +import 'rxjs/add/observable/of'; +import { environment } from 'src/environments/environment'; +import { ReportListService } from './report-list.service'; describe('ReportListComponent', () => { let component: ReportListComponent; let fixture: ComponentFixture<ReportListComponent>; + let http: HttpClient; + let reportService : ReportListService; + let environment = [ + { baseUrl : 'just for test' } + ] beforeEach(async(() => { TestBed.configureTestingModule({ @@ -25,9 +35,14 @@ describe('ReportListComponent', () => { MatSortModule, MatTableModule, HttpClientTestingModule, - RouterTestingModule - ] + RouterTestingModule, + ], + providers: [HttpClient, ReportListService] }).compileComponents(); + + reportService = TestBed.get(ReportListService); + http = TestBed.get(HttpClient); + spyOn(reportService, 'deleteReport').and.returnValue(Observable.of(environment)); })); beforeEach(() => { @@ -96,7 +111,9 @@ describe('ReportListComponent', () => { }); it('should test deleteReport method', () => { + spyOn(component, 'deleteReport').and.callThrough(); component.deleteReport(); + expect(component.deleteReport).toHaveBeenCalled(); }); it('should test openReportSchedule method', () => { |