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, MatTableDataSource } from '@angular/material/table';
7 import { ReportListComponent } from './report-list.component';
8 import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
9 import { HttpClientTestingModule } from '@angular/common/http/testing';
10 import { RouterTestingModule } from '@angular/router/testing';
11 import { Router } from '@angular/router';
12 import { AllReportsDataSource } from './report-list-datasource';
14 describe('ReportListComponent', () => {
15 let component: ReportListComponent;
16 let fixture: ComponentFixture<ReportListComponent>;
18 beforeEach(async(() => {
19 TestBed.configureTestingModule({
20 schemas: [CUSTOM_ELEMENTS_SCHEMA],
21 declarations: [ ReportListComponent ],
27 HttpClientTestingModule,
30 }).compileComponents();
34 fixture = TestBed.createComponent(ReportListComponent);
35 component = fixture.componentInstance;
36 fixture.detectChanges();
39 it('should compile', () => {
40 expect(component).toBeTruthy();
43 it('should test initializeReportList method', () => {
44 component.initializeReportList();
45 expect(component.showSpinner).toEqual(true);
46 expect(component.dataSource).toEqual(new AllReportsDataSource());
47 expect(component.intermediateDisplayedColumns).toEqual(new Array());
48 expect(component.finalGETObj).toEqual(new Object());
49 expect(component.finalGETObjRowsArr).toEqual(new Array());
50 expect(component.rowArr).toEqual(new Array());
51 expect(component.reportIdArr).toEqual(new Array());
52 expect(component.toggle).toEqual(false);
53 expect(component.toggle1).toEqual(false);
54 expect(component.finalRowArr).toEqual(new Array());
57 it('should test ngOnInit method', () => {
59 expect(component.toggle).toEqual(false);
62 it('should test confirmDelete method', () => {
63 component.confirmDelete("test");
64 expect(component.showDialog).toEqual(true);
65 expect(component.closable).toEqual(true);
66 expect(component.newReportId).toEqual("test");
69 it('should test ngAfterViewInit method', () => {
70 component.ngAfterViewInit();
71 expect(component.dataSource.sort).toEqual(component.sort);
72 expect(component.dataSource.paginator).toEqual(component.paginator);
73 expect(component.table.dataSource).toEqual(component.dataSource);
76 it('should test displayReport method', () => {
77 component.displayReport("Testing");
78 expect(component.reportId).toEqual("Testing");
81 it('should test runReport method', () => {
82 component.runReport("Test");
83 expect(component.reportId).toEqual("Test");
86 it('should test applyFilter method', () => {
87 component.applyFilter("ABC");
88 expect(component.dataSource1.filter).toEqual("abc");
92 it('should test close method', () => {
94 expect(component.showDialog).toEqual(true);
95 expect(component.closable).toEqual(false);
98 it('should test deleteReport method', () => {
99 component.deleteReport();
102 it('should test openReportSchedule method', () => {
103 component.openReportSchedule("test");