import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatSortModule } from '@angular/material/sort';
-import { MatTableModule, MatTableDataSource } from '@angular/material/table';
+import { MatTableModule} from '@angular/material/table';
-import { RunReportComponent, PeriodicElement } from './run-report.component';
-import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SimpleChange, SimpleChanges } from '@angular/core';
+import { RunReportComponent} from './run-report.component';
+import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, SimpleChanges } from '@angular/core';
import { MatMenuModule } from '@angular/material';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { RouterTestingModule } from '@angular/router/testing';
let runService : RunService;
let options1 = {};
let dashboard;
- let dashboard2;
let responseformfield = 1;
let environment = [
{
baseUrl: 'just a link'
}
- ]
+ ];
beforeEach(async(() => {
providers: [RunService]
}).compileComponents();
runService = TestBed.get(RunService);
- //spyOn(runService, 'getReportDataWithFormFields').and.returnValue(Observable.of(environment));
- //spyOn(runService, 'getReportData').and.returnValue(Observable.of(environment));
spyOn(runService, 'downloadReportExcel').and.returnValue(Observable.of(environment));
}));
beforeEach(() => {
- //dashboard = {"item":{"hasContent":{"name":"rupi","id":"check#check"}}};
fixture = TestBed.createComponent(RunReportComponent);
runService = TestBed.get(RunService);
component = fixture.componentInstance;
expect(component.NEWdisplayedColumns).toEqual(new Array());
});
+
it('should test showError method', () => {
let errmsg = "errormessage";
let stcktrace = "stacktrace";
it('should test the ngOnChanges first If condition', () => {
change = {};
+ component.queryString="queryString";
+ component.reportId1="reportId1";
+ var response={"errormessage":true}
component.reportMode !== "Regular"
component.initCnt = 1;
component.TriggerFFArr.length = 0;
+ let spy=spyOn(runService,'getReportDataWithFormFields').and.returnValue(Observable.of(response));
component.ngOnChanges(change);
- expect(component.showMoreVert).toEqual(false);
+ expect(spy).toHaveBeenCalled();
expect(component.initCnt).toEqual(1);
expect(component.showDashboardReport).toEqual(false);
expect(component.displayedRowObj).toEqual(new Array());
expect(component.displayedColumns).toEqual(new Array());
expect(component.formFieldList).toEqual(new Array());
- expect(component.showSpinner).toEqual(true);
expect(component.NEWdisplayedColumns).toEqual(new Array());
expect(component.isReady).toEqual(false);
+
});
+
it('should test initialProcess method', () => {
component.DashboardReportObj.length = 1;
component.initialProcesses();
});
- // it('should test postFetchingReportDataFn method', () => {
- // let response: any;
- // component.postFetchingReportDataFn(response);
- // })
-
- // it('should test ngOnChanges subscribe method', () => {
- // spyOn(component, 'ngOnChanges').and.callThrough();
- // component.ngOnChanges(change);
- // expect(component.ngOnChanges).toHaveBeenCalled();
+ // it('should test postFetchingReportDataFn method',()=>{
+ // var response={
+ // "reportName":"reportName",
+ // "reportDataColumns":[{"columnTitle":"columnTitle","colId":"colId"}],
+ // "reportDataRows":[{"value":"value"}]
+ // }
+ // component.displayedColumnsArr=["string"]
+ // component.postFetchingReportDataFn(response)
// })
- // it('should test postFetchingReportDataFn method', () => {
- // let obj: any;
- // component.postFetchingReportDataFn(obj);
- // })
-
+
});