summaryrefslogtreecommitdiffstats
path: root/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
blob: d1ed806814a90bc3aafca1dab2de9f63fab5871c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
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({
      schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA], 
      declarations: [ 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();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });

  it('should test ngOnInit method', () => {
    spyOn(component, 'ngOnInit').and.callThrough();
      component.ngOnInit();
      expect(component.ngOnInit).toHaveBeenCalled();
  });

  it('should test changedOption method', () => {    
    component.changedOptions();
  });

  it('should test assignCopy method', () => {
      component.assignCopy();
  });

  it('should test filterItem method', () => {
      component.filterItem(1);
  });

  it('should test addItem method', () => {
      component.addItem();
  });

  it('should test emptyCellClick method', () => {
    let event: MouseEvent;
    let item: GridsterItem;
    component.emptyCellClick(event, item);
  });

});