diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-02-24 15:47:35 +0530 |
---|---|---|
committer | Indrijeet kumar <indriku1@in.ibm.com> | 2020-02-24 15:47:45 +0530 |
commit | 30b9b3c4c8957702c7bfdc5bfb1d606a120a6af2 (patch) | |
tree | ba6311f0dd934f9e7d9398353c9fefee2955e35b | |
parent | 9a5ecbebf8d687c13275d32ad8400ee4b553cc59 (diff) |
some test cases for form-fields components
some test cases written for form-fields components
Issue-ID: PORTAL-813
Change-Id: I3729bcc8f122fd1bbf416b6f0ce7e6414d2ca252
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts index 42544a72..1dab68ba 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts @@ -1,6 +1,11 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FormFieldsComponent } from './form-fields.component'; +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { FormsModule } from '@angular/forms'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { MatDialogModule, MatSnackBarModule } from '@angular/material'; +import { CommonModule } from '@angular/common'; describe('FormFieldsComponent', () => { let component: FormFieldsComponent; @@ -8,7 +13,9 @@ describe('FormFieldsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ FormFieldsComponent ] + schemas:[CUSTOM_ELEMENTS_SCHEMA], + declarations: [ FormFieldsComponent ], + imports:[FormsModule,HttpClientTestingModule,MatDialogModule,MatSnackBarModule] }) .compileComponents(); })); @@ -22,4 +29,25 @@ describe('FormFieldsComponent', () => { it('should create', () => { expect(component).toBeTruthy(); }); + + it('should test isFirst method',()=>{ + expect(component.isFirst(0)).toBe(true); + expect(component.isFirst(2)).toBe(false); + }); + + it('should test isLast method', () =>{ + component.formFieldsListObj.length = 12; + expect(component.isLast(15)).toEqual(false); + }); + + it('should test ngDoCheck method',()=>{ + component.sqlAsDefaultValue=true; + if(component.sqlAsDefaultValue==true){ + expect(component.showDefaultSQLOption).toBe(false); + } + else{ + expect(component.showDefaultSQLOption).toBe(true); + } + }); + }); |