diff options
author | Rupinder <rupinsi1@in.ibm.com> | 2020-02-27 17:06:10 +0530 |
---|---|---|
committer | Rupinder <rupinsi1@in.ibm.com> | 2020-02-27 17:06:14 +0530 |
commit | 2f4933972828e6123f3e44d2a7747e69831aeccd (patch) | |
tree | cdb4276ab1ea023341bc3b42b200a70acbc31ea4 /ecomp-sdk | |
parent | 37db40a2dc6e811e919b912579fbbb2b1d8cedba (diff) |
wrote test cases for run-report-form-fields comp
Written test cases for run-report-form-fields.component.spec.ts
Issue-ID: PORTAL-834
Change-Id: I2e50cce7c283e9cca569f472cb024d43c16b794b
Signed-off-by: Rupinder<rupinsi1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk')
-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 | 39 |
1 files changed, 37 insertions, 2 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 a273f9e0..d693ebc0 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 @@ -1,6 +1,10 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - +import {FormsModule} from '@angular/forms'; import { RunReportFormFieldsComponent } from './run-report-form-fields.component'; +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'; describe('RunReportFormFieldsComponent', () => { let component: RunReportFormFieldsComponent; @@ -8,6 +12,8 @@ describe('RunReportFormFieldsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ + schemas: [CUSTOM_ELEMENTS_SCHEMA], + imports: [FormsModule, MatDatepickerModule, HttpClientTestingModule, RouterTestingModule], declarations: [ RunReportFormFieldsComponent ] }) .compileComponents(); @@ -22,4 +28,33 @@ describe('RunReportFormFieldsComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); -}); + + it('should test ngOnInit method', () => { + component.ngOnInit(); + expect(component.showSpinner).toEqual(true); + expect(component.navigateToRun).toEqual(false); + }); + + it('should test getQueryString method', () => { + component.directCallQueryParams !== ''; + component.getQueryString(); + expect(component.getQueryString()).toEqual(component.directCallQueryParams); + component.directCallQueryParams == ''; + component.getQueryString(); + expect(component.getQueryString()).toEqual(component.queryString); + }); + + it('should test showError method', () => { + component.showError('test'); + expect(component.errorMessage).toEqual('test'['errormessage']); + expect(component.stackTrace).toEqual('test'['stacktrace']); + expect(component.error).toEqual(true); + expect(component.showSpinner).toEqual(false); + }); + + it('should test showLabelFn method', () => { + component.showLabelFn(); + expect(component.showLabel).toEqual(component.showLabel); + }); + +});
\ No newline at end of file |