summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay
diff options
context:
space:
mode:
authorIndrijeet kumar <indriku1@in.ibm.com>2020-04-30 10:03:58 +0530
committerIndrijeet kumar <indriku1@in.ibm.com>2020-04-30 10:04:05 +0530
commit4a0e64cff7a3688069aa789e5e755dc0c948a124 (patch)
tree1ab484cda1fbbbd18a54b9f1a24f14522d6aee93 /ecomp-sdk/epsdk-app-overlay
parentc7f033eec8a0a88a2ae0d200b5cc5f25fe41e70f (diff)
some test cases in form-fields component
some test cases in form-fields component Issue-ID: PORTAL-813 Change-Id: Ibc281d4e37567c1b79bd142fa3020f5313a04b6d Signed-off-by: Indrijeet Kumar <indriku1@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/form-fields/form-fields.component.spec.ts50
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();