summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/report-list.component.spec.ts23
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', () => {