diff options
author | Lorraine Welch <lb2391@att.com> | 2020-05-01 18:45:59 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-05-01 18:45:59 +0000 |
commit | 0bc971a79973fbcf19d9c804d37f0c9f44833192 (patch) | |
tree | f4c5b2bc707cfd0df401b73892bdf2c1fe18f1f9 /ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp | |
parent | 82512f09139185da7361adf91def48cdfdab532d (diff) | |
parent | 4a0e64cff7a3688069aa789e5e755dc0c948a124 (diff) |
Merge "some test cases in form-fields component"
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp')
-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 | 50 |
1 files changed, 48 insertions, 2 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 7cc85b94..780b3e79 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 @@ -4,7 +4,7 @@ import { FormFieldsComponent, DialogOverviewExampleDialog } from './form-fields. 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 { MatDialogModule, MatSnackBarModule, MatDialog } from '@angular/material'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { FormFieldsService } from './form-fields.service'; import 'rxjs/add/observable/of'; @@ -25,6 +25,7 @@ describe('FormFieldsComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ schemas:[CUSTOM_ELEMENTS_SCHEMA], + providers:[MatDialog,DialogOverviewExampleDialog], declarations: [ FormFieldsComponent, DialogOverviewExampleDialog @@ -34,7 +35,7 @@ describe('FormFieldsComponent', () => { HttpClientTestingModule, MatDialogModule, MatSnackBarModule, - BrowserAnimationsModule + BrowserAnimationsModule, ] }) TestBed.overrideModule(BrowserDynamicTestingModule,{ @@ -56,6 +57,39 @@ describe('FormFieldsComponent', () => { expect(component).toBeTruthy(); }); + it('should test moveUpward method',()=>{ + component.postDownwardObj={"indrijeet":"kumar"}; + component.reportId1="reportId1"; + component.formFieldsListObj=[{"id":123}, + {"id":321}]; + var responsePostn={"message":true}; + var postDownwardObj={"orderSeq":1}; + var finalListResponse={"orderSeq":1}; + let spy1=spyOn(_formfieldservice,'getFormFieldData').and.returnValue(Observable.of(postDownwardObj)); + let spy2=spyOn(_formfieldservice,'postFormFieldData').and.returnValue(Observable.of(responsePostn)); + let spy3=spyOn(_formfieldservice,'getListOfFormFields').and.returnValue(Observable.of(finalListResponse)); + component.moveUpward(1); + expect(spy1).toHaveBeenCalled(); + expect(spy2).toHaveBeenCalled(); + expect(spy3).toHaveBeenCalled(); + }) + + it('should test moveDownward method',()=>{ + component.postDownwardObj={"indrijeet":"kumar"}; + component.reportId1="reportId1"; + component.formFieldsListObj=[{"id":123}, + {"id":321}]; + var responsePostn={"message":true}; + var postDownwardObj={"orderSeq":1}; + var finalListResponse={"orderSeq":1}; + let spy1=spyOn(_formfieldservice,'getFormFieldData').and.returnValue(Observable.of(postDownwardObj)); + let spy2=spyOn(_formfieldservice,'postFormFieldData').and.returnValue(Observable.of(responsePostn)); + let spy3=spyOn(_formfieldservice,'getListOfFormFields').and.returnValue(Observable.of(finalListResponse)); + component.moveDownward(0); + expect(spy1).toHaveBeenCalled(); + expect(spy2).toHaveBeenCalled(); + expect(spy3).toHaveBeenCalled(); + }) it('should test verify method',()=>{ spyOn(_formfieldservice,'verifySQL').and.returnValue(Observable.of(responseDefaultSQL)) @@ -246,6 +280,18 @@ it('should test createGroup method',()=>{ component.openDialog() }) + // it('should test openDialog method',()=>{ + // var result={"Name":"name"}; + // component.Groups=null; + // const dialogRef = component.dialog.open(DialogOverviewExampleDialog, { + // width: '400px', + // height: '600px', + // data: component.formFieldsListObj + // }); + // spyOn(dialogRef,'afterClosed').and.returnValue(result); + // component.openDialog(); + // }) + it('should test createGroup method',()=>{ let spy=spyOn(component,'openDialog'); component.createGroup(); |