summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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