import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
import { DefinitionComponent } from './definition.component';
import { CUSTOM_ELEMENTS_SCHEMA} from '@angular/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
"reportId":123,
"reportName":"reportName",
"reportDescr":"reportDescr",
- "reportType":"reportType",
+ "reportType":"Linear",
"dbInfo":"dbInfo",
"formHelpText":"formHelpText",
"repDefType":"repDefType",
"weeklyRec":true,
"monthlyRec":true,
"dashboardLayoutJSON":'"data"',
- "dashboardLayoutHTML":"dashboardLayoutHTML"
+ "dashboardLayoutHTML":"dashboardLayoutHTML",
+ "displayArea":{"selected":true}
}
beforeEach(async(() => {
});
it('should test ngOnInit method',()=>{
- var params={
- "reportId":100
- };
component.IncomingReportId=-1;
component.reportMode="Create";
- //spyOn(activatedRoute,'params').and.returnValue(Observable.of(params));
let spy=spyOn(_definitionService,'getDefinitionPageDetails').and.returnValue(Observable.of(response));
component.ngOnInit();
expect(spy).toHaveBeenCalled();
+ expect(_definitionService.getDefinitionPageDetails).toHaveBeenCalled();
expect(component.isEdit).toBe(true);
expect(component.showDialog).toBe(false);
});
+ it('should test ngOnInit method',()=>{
+ component.IncomingReportId=1;
+ component.reportMode="Edit";
+ let spy=spyOn(_definitionService,'getDefinitionPageDetails').and.returnValue(Observable.of(response));
+ component.ngOnInit();
+ expect(spy).toHaveBeenCalled();
+ expect(_definitionService.getDefinitionPageDetails).toHaveBeenCalled();
+ });
+
it('should test first if condition in saveDefinitionInfo method',()=>{
component.IncomingReportId=-1;
component.reportMode="Create";