summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp
diff options
context:
space:
mode:
authorRupinder <rupinsi1@in.ibm.com>2020-04-17 19:12:24 +0530
committerRupinder <rupinsi1@in.ibm.com>2020-04-17 19:12:32 +0530
commita2af683e8d8c24a33274908b7e0288f7c6e51978 (patch)
treea3a1f60c7a5949c4532b94b33c34eef478559c5f /ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp
parent9ac990d143c7eb57424609a091308245d3072466 (diff)
wrote test case for dashboard-report-grid comp
Issue-ID: PORTAL-834 Change-Id: I19df9558a5688a43521bff01df0154cb4955a3fd Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts
index 6d0c2946..d1ed8068 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/definition/dashboard-report-grid/dashboard-report-grid.component.spec.ts
@@ -3,10 +3,21 @@ import { FormsModule } from '@angular/forms';
import { DashboardReportGridComponent } from './dashboard-report-grid.component';
import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { DashboardReportService } from '../../run/run-report/run-dashboard-report/dashboard-report.service';
+import { DashboardReportGridService } from './dashboard-report-grid.service';
+import 'rxjs/add/observable/of';
+import { Observable } from 'rxjs';
+import { GridsterItem } from 'angular-gridster2';
describe('DashboardReportGridComponent', () => {
let component: DashboardReportGridComponent;
let fixture: ComponentFixture<DashboardReportGridComponent>;
+ let service;
+ let environment = [
+ {
+ baseUrl: 'just for testing'
+ }
+ ];
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -15,11 +26,15 @@ describe('DashboardReportGridComponent', () => {
imports: [FormsModule, HttpClientTestingModule]
})
.compileComponents();
+ service = TestBed.get(DashboardReportGridService);
+ spyOn(service, 'getReportList').and.returnValue(Observable.of(environment));
}));
beforeEach(() => {
fixture = TestBed.createComponent(DashboardReportGridComponent);
component = fixture.componentInstance;
+ environment ["rows"] = [""];
+ component.dashboard ["hasContent"] = [""];
fixture.detectChanges();
});
@@ -28,7 +43,9 @@ describe('DashboardReportGridComponent', () => {
});
it('should test ngOnInit method', () => {
+ spyOn(component, 'ngOnInit').and.callThrough();
component.ngOnInit();
+ expect(component.ngOnInit).toHaveBeenCalled();
});
it('should test changedOption method', () => {
@@ -47,4 +64,10 @@ describe('DashboardReportGridComponent', () => {
component.addItem();
});
+ it('should test emptyCellClick method', () => {
+ let event: MouseEvent;
+ let item: GridsterItem;
+ component.emptyCellClick(event, item);
+ });
+
}); \ No newline at end of file