diff options
author | Rupinder <rupinsi1@in.ibm.com> | 2020-03-04 18:56:21 +0530 |
---|---|---|
committer | Rupinder <rupinsi1@in.ibm.com> | 2020-03-04 18:56:33 +0530 |
commit | 2b20eaa7ab61d575cb031d521eb1cd263cae817c (patch) | |
tree | 7641ec9efbc35212282f7b974eb5842d711f7d0b /ecomp-sdk/epsdk-app-overlay | |
parent | ba569c5c747d1198cb336df38d191971e93eeb9b (diff) |
added test case for run-report-form-fields
Written test case for run-report-form-fields component
Issue-ID: PORTAL-834
Change-Id: Iabffc838804323af0c75b92cc7fb90530ef0eddf
Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay')
-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 |