diff options
author | Lorraine Welch <lb2391@att.com> | 2020-03-04 14:52:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-03-04 14:52:10 +0000 |
commit | 4ace5de27e8015f3d33d0792e1880e837ebad35e (patch) | |
tree | 887c45767cb5b61fe433baf561a98a3a10707ed3 | |
parent | 599d102c624d6dc4ce27be1c704f05e0a5dcae83 (diff) | |
parent | 2b20eaa7ab61d575cb031d521eb1cd263cae817c (diff) |
Merge "added test case for run-report-form-fields"
-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 | 63 |
1 files changed, 58 insertions, 5 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 d693ebc0..c922b359 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 @@ -9,6 +9,7 @@ import { RouterTestingModule } from '@angular/router/testing'; describe('RunReportFormFieldsComponent', () => { let component: RunReportFormFieldsComponent; let fixture: ComponentFixture<RunReportFormFieldsComponent>; + let formfield =[{"validationType":1},{},{}] ; beforeEach(async(() => { TestBed.configureTestingModule({ @@ -22,6 +23,7 @@ describe('RunReportFormFieldsComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(RunReportFormFieldsComponent); component = fixture.componentInstance; + component.formFieldList = formfield; fixture.detectChanges(); }); @@ -31,15 +33,20 @@ describe('RunReportFormFieldsComponent', () => { it('should test ngOnInit method', () => { component.ngOnInit(); - expect(component.showSpinner).toEqual(true); - expect(component.navigateToRun).toEqual(false); + // expect(component.showSpinner).toEqual(true); + // expect(component.navigateToRun).toEqual(false); }); - it('should test getQueryString method', () => { - component.directCallQueryParams !== ''; + it('should test convertDate method', () => { + component.convertDate("test"); + }); + + it('should test getQueryString methods', () => { + component.directCallQueryParams = 'abc'; component.getQueryString(); expect(component.getQueryString()).toEqual(component.directCallQueryParams); - component.directCallQueryParams == ''; + + component.directCallQueryParams = ""; component.getQueryString(); expect(component.getQueryString()).toEqual(component.queryString); }); @@ -57,4 +64,50 @@ describe('RunReportFormFieldsComponent', () => { expect(component.showLabel).toEqual(component.showLabel); }); + it('should test editReport method', () => { + component.editReport("test"); + }); + + it('should test runReport method', () => { + component.iSDashboardReport = "test"; + component.formFieldList.length = 1; + component.runReport(); + + expect(component.hitCnt).toBe(component.hitCnt++); + expect(component.reportMode).toBe("FormField"); + let spy = spyOn(component, 'generateQueryString'); + component.generateQueryString(); + expect(component.generateQueryString).toHaveBeenCalled(); + expect(component.showSpinner).toBe(false); + + component.iSDashboardReport = "test"; + component.formFieldList.length = 0; + component.runReport(); + + expect(component.reportMode).toBe("Regular"); + + component.iSDashboardReport = "Dashboard"; + component.runReport(); + expect(component.showSpinner).toBe(false); + expect(component.navigateToRun).toBe(true); + + + }); + + it('should test ngDoCheck method', () =>{ + component.formFieldList != undefined; + component.oldGroupSelectValue = "test"; + component.groupSelectValue = "testing"; + component.ngDoCheck(); + + expect(component.oldGroupSelectValue).toBe(component.groupSelectValue); + }); + + it('should test fetchAndPopulateFormFields method', () => { + component.fetchAndPopulateFormFields(1, "test"); + }) + + it('should test generateQueryString method',() => { + component.generateQueryString(); + }) });
\ No newline at end of file |