diff options
author | Lorraine Welch <lb2391@att.com> | 2020-04-01 16:33:19 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-01 16:33:19 +0000 |
commit | ffd302b5b1c325f4d905363d7c9beb49c826e9e2 (patch) | |
tree | 04acfcb9d71d74b40cdd3f14bbedc488bb2f9891 /ecomp-sdk/epsdk-app-overlay/src/main | |
parent | 63a54ac2067f0e30f40cf5b195a1de0b29da5ca8 (diff) | |
parent | b2569d001f2bfa0b18d5e88c9c9e95b7326cc616 (diff) |
Merge "added test case for run-report-form-fields"
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main')
-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 |