1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 import { NoopAnimationsModule } from '@angular/platform-browser/animations';
3 import { MatPaginatorModule } from '@angular/material/paginator';
4 import { MatSortModule } from '@angular/material/sort';
5 import { MatTableModule } from '@angular/material/table';
7 import { RunReportResultSetComponent } from './run-report-result-set.component';
8 import { HttpClientTestingModule } from '@angular/common/http/testing';
9 import { RouterTestingModule } from '@angular/router/testing';
10 import { RunService } from '../run.service';
11 import 'rxjs/add/observable/of';
12 import { Observable } from 'rxjs/Observable';
13 import 'rxjs/add/operator/catch';
14 import 'rxjs/add/observable/throw';
16 describe('RunReportResultSetComponent', () => {
17 let component: RunReportResultSetComponent;
18 let fixture: ComponentFixture<RunReportResultSetComponent>;
19 let _runService:RunService;
21 "reportDataColumns":[{"columnTitle":"columnTitle"}],
22 "reportDataRows":[{"colId":"colId"}]
25 beforeEach(async(() => {
26 TestBed.configureTestingModule({
27 declarations: [ RunReportResultSetComponent ],
33 HttpClientTestingModule,
36 }).compileComponents();
40 fixture = TestBed.createComponent(RunReportResultSetComponent);
41 component = fixture.componentInstance;
42 fixture.detectChanges();
43 _runService=TestBed.get(RunService);
46 it('should compile', () => {
47 expect(component).toBeTruthy();
50 it('should test ngOnInit method',()=>{
51 component.reportId1="reportId1";
52 let spy=spyOn(_runService,'getReportData').and.returnValue(Observable.of(response));
54 expect(spy).toHaveBeenCalled();
58 it('should test ngAfterViewInit method',()=>{
59 component.reportId1="reportId1";
60 let spy=spyOn(_runService,'getReportData').and.returnValue(Observable.of(response))
61 component.ngAfterViewInit();
62 expect(spy).toHaveBeenCalled();