diff options
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts index c922b359..a1906c85 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/run/run-report-form-fields/run-report-form-fields.component.spec.ts @@ -5,19 +5,37 @@ import { CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core'; import {MatDatepickerModule} from '@angular/material/datepicker'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { RouterTestingModule } from '@angular/router/testing'; +import { RunService } from '../run.service'; +import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/observable/of'; +import { of } from 'rxjs'; describe('RunReportFormFieldsComponent', () => { let component: RunReportFormFieldsComponent; let fixture: ComponentFixture<RunReportFormFieldsComponent>; let formfield =[{"validationType":1},{},{}] ; + let runService: RunService; + let environment = [ + { + baseUrl: 'just for testing' + } + ] beforeEach(async(() => { TestBed.configureTestingModule({ schemas: [CUSTOM_ELEMENTS_SCHEMA], imports: [FormsModule, MatDatepickerModule, HttpClientTestingModule, RouterTestingModule], - declarations: [ RunReportFormFieldsComponent ] + declarations: [ RunReportFormFieldsComponent ], + providers: [RunService] }) .compileComponents(); + runService = TestBed.get(RunService); + // spyOn(runService, 'getReportData').and.returnValue(Observable.of(environment)); + // spyOn(runService, 'getReportDataWithFormFields').and.returnValue(Observable.of(environment)); + spyOn(runService, 'getDefinitionPageDetails').and.returnValue(Observable.of(environment)); + spyOn(runService, 'refreshFormFields').and.returnValue(Observable.of(environment)); + // spyOn(runService, 'downloadReportExcel').and.returnValue(Observable.of(environment)); + spyOn(runService, 'getFormFieldGroupsData').and.returnValue(Observable.of(environment)); })); beforeEach(() => { @@ -31,12 +49,6 @@ describe('RunReportFormFieldsComponent', () => { expect(component).toBeTruthy(); }); - it('should test ngOnInit method', () => { - component.ngOnInit(); - // expect(component.showSpinner).toEqual(true); - // expect(component.navigateToRun).toEqual(false); - }); - it('should test convertDate method', () => { component.convertDate("test"); }); @@ -98,16 +110,28 @@ describe('RunReportFormFieldsComponent', () => { component.formFieldList != undefined; component.oldGroupSelectValue = "test"; component.groupSelectValue = "testing"; + // component.toggleFormFieldRenderArr.length = 1; + spyOn(component, 'ngDoCheck').and.callThrough(); component.ngDoCheck(); - + expect(component.ngDoCheck).toHaveBeenCalled(); expect(component.oldGroupSelectValue).toBe(component.groupSelectValue); }); - it('should test fetchAndPopulateFormFields method', () => { - component.fetchAndPopulateFormFields(1, "test"); - }) - it('should test generateQueryString method',() => { component.generateQueryString(); - }) + }) + + it('should test ngOnInit method', () => { + spyOn(component, 'ngOnInit').and.callThrough(); + component.ngOnInit(); + expect(component.ngOnInit).toHaveBeenCalled(); + }); + +// it('should test fetchAndPopulateFormFields method', () => { +// spyOn(component, 'fetchAndPopulateFormFields').and.callThrough(); +// component.formFieldGroupObjList = null; +// component.fetchAndPopulateFormFields(1, "test"); +// expect(component.fetchAndPopulateFormFields).toHaveBeenCalled(); +// }); + });
\ No newline at end of file |