summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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.ts107
1 files changed, 106 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 1dab68ba..8d9003fc 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
@@ -6,6 +6,7 @@ import { FormsModule } from '@angular/forms';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { MatDialogModule, MatSnackBarModule } from '@angular/material';
import { CommonModule } from '@angular/common';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('FormFieldsComponent', () => {
let component: FormFieldsComponent;
@@ -15,7 +16,13 @@ describe('FormFieldsComponent', () => {
TestBed.configureTestingModule({
schemas:[CUSTOM_ELEMENTS_SCHEMA],
declarations: [ FormFieldsComponent ],
- imports:[FormsModule,HttpClientTestingModule,MatDialogModule,MatSnackBarModule]
+ imports:[
+ FormsModule,
+ HttpClientTestingModule,
+ MatDialogModule,
+ MatSnackBarModule,
+ // BrowserAnimationsModule
+ ]
})
.compileComponents();
}));
@@ -50,4 +57,102 @@ describe('FormFieldsComponent', () => {
}
});
+ it('should test setDisplayMode method',()=>{
+ component.setDisplayMode("setDisplayMode");
+ });
+
+ it('should test edit method',()=>{
+ component.edit("Id");
+
+ })
+
+ it('should test add method',()=>{
+ component.add();
+ expect(component.showDialog).toBe(true);
+ expect(component.closable).toBe(true);
+ expect(component.validationType).toEqual("");
+ expect(component.visible).toEqual("YES");
+ expect(component.message).toBe("");
+ expect(component.groupFormField).toBe(false);
+ expect(component.fieldType).toBe("");
+ expect(component.fieldSQL).toBe("");
+ expect(component.fieldName).toBe("");
+ expect(component.fieldId).toBe("");
+ expect(component.fieldDefaultSQL).toBe('');
+ expect(component.errorStackTrace).toBe("");
+ expect(component.errorMessage).toBe("");
+ expect(component.defaultValue).toBe(false);
+ expect(component.predefinedValueList).toEqual([]);
+ expect(component.showDialog).toBe(true);
+ expect(component.closable).toBe(true);
+ expect(component.mode).toEqual("Add");
+ });
+
+ it('should test close method1',()=>{
+ component.showDialog=true;
+ component.close();
+ expect(component.showDialog).toBe(false);
+ expect(component.closable).toBe(false);
+ });
+
+ it('should test close method2',()=>{
+ component.showDialog=false;
+ component.close();
+ expect(component.showDialog).toBe(true);
+ expect(component.closable).toBe(false);
+});
+
+ it('should test loseValidateModal method1',()=>{
+ component.showDialog1=true;
+ component.closeValidateModal();
+ expect(component.showDialog1).toBe(false);
+ expect(component.showVerifySpinner).toBe(false);
+ })
+
+ it('should test loseValidateModal method2',()=>{
+ component.showDialog1=false;
+ component.closeValidateModal();
+ expect(component.showDialog1).toBe(true);
+ expect(component.showVerifySpinner).toBe(false);
+});
+
+it('should test addToList method',()=>{
+ component.addToList("attrib")
+ {
+ expect(component.predefinedValueList.pop()).toEqual({id:'attrib', name:'attrib',selected:false});
+ }
+});
+
+it('should test deleteFromList method',()=>{
+component.deleteFromList("attrib");
+});
+
+it('should test save method',()=>{
+ component.save();
+ expect(component.showSpinner).toBe(true);
+ expect(component.showDialog).toBe(false);
+ expect(component.finalPOSTObj["validationType"]).toEqual(component.validationType);
+ if(component.visible=="YES")
+ expect(component.finalPOSTObj["visible"]).toBe(true);
+ else
+ expect(component.finalPOSTObj["visible"]).toBe(false);
+ expect(component.finalPOSTObj["orderSeq"]).toEqual(component.orderSeq);
+ expect(component.finalPOSTObj["message"]).toEqual(component.message);
+ expect(component.finalPOSTObj["groupFormField"]).toEqual(component.groupFormField);
+ expect(component.finalPOSTObj["fieldType"]).toEqual(component.fieldType);
+ expect(component.finalPOSTObj["fieldSQL"]).toEqual(component.fieldSQL);
+ expect(component.finalPOSTObj["fieldName"]).toEqual(component.fieldName);
+ expect(component.finalPOSTObj["fieldId"]).toEqual(component.fieldId);
+ expect(component.finalPOSTObj["errorStackTrace"]).toEqual(component.errorStackTrace);
+ expect(component.finalPOSTObj["errorMessage"]).toEqual(component.errorMessage);
+ expect(component.finalPOSTObj["defaultValue"]).toEqual(component.defaultValue);
+ if(component.defaultValue===false)
+ expect(component.finalPOSTObj["fieldDefaultSQL"]).toBe(null);
+ else
+ expect(component.finalPOSTObj["fieldDefalultSQL"]).toEqual(component.fieldDefaultSQL);
+ expect(component.finalPOSTObj["predefinedValueList"]).toEqual(component.predefinedValueList);
+
+});
+
+
});