1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 import { FormsModule } from '@angular/forms';
3 import { DashboardReportGridComponent } from './dashboard-report-grid.component';
4 import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
5 import { HttpClientTestingModule } from '@angular/common/http/testing';
6 import { DashboardReportService } from '../../run/run-report/run-dashboard-report/dashboard-report.service';
7 import { DashboardReportGridService } from './dashboard-report-grid.service';
8 import 'rxjs/add/observable/of';
9 import { Observable } from 'rxjs';
10 import { GridsterItem } from 'angular-gridster2';
12 describe('DashboardReportGridComponent', () => {
13 let component: DashboardReportGridComponent;
14 let fixture: ComponentFixture<DashboardReportGridComponent>;
18 baseUrl: 'just for testing'
22 beforeEach(async(() => {
23 TestBed.configureTestingModule({
24 schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA],
25 declarations: [ DashboardReportGridComponent ],
26 imports: [FormsModule, HttpClientTestingModule]
29 service = TestBed.get(DashboardReportGridService);
30 spyOn(service, 'getReportList').and.returnValue(Observable.of(environment));
34 fixture = TestBed.createComponent(DashboardReportGridComponent);
35 component = fixture.componentInstance;
36 environment ["rows"] = [""];
37 component.dashboard ["hasContent"] = [""];
38 fixture.detectChanges();
41 it('should create', () => {
42 expect(component).toBeTruthy();
45 it('should test ngOnInit method', () => {
46 spyOn(component, 'ngOnInit').and.callThrough();
48 expect(component.ngOnInit).toHaveBeenCalled();
51 it('should test changedOption method', () => {
52 component.changedOptions();
55 it('should test assignCopy method', () => {
56 component.assignCopy();
59 it('should test filterItem method', () => {
60 component.filterItem(1);
63 it('should test addItem method', () => {
67 it('should test emptyCellClick method', () => {
68 let event: MouseEvent;
69 let item: GridsterItem;
70 component.emptyCellClick(event, item);