summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
authorRupinder <rupinsi1@in.ibm.com>2020-03-27 18:40:25 +0530
committerRupinderjeet Singh <rupinsi1@in.ibm.com>2020-04-01 10:56:14 +0000
commitc2e11a10dd1de0c6370576293ecf7e5a3cd470b2 (patch)
tree99af3394fac9ec8fcd94552ede8d99060c8d17fa /ecomp-sdk
parent20c95c7edd0861504b50cd86a65ce888b1c6efa6 (diff)
added test cases for report-list comp
Added more test cases for report-list.component.spec.ts Issue-ID: PORTAL-834 Change-Id: I19bcce53c0f839271d4fd6efd6f11970d38dee9f Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
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', () => {