Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('Decorator', () => {
let formBuilder = new RxFormBuilder();
beforeEach(() => {
ReactiveFormConfig.set({
"validationMessage": {
"maxDate": "Maximum Date is not matched",
}
});
});
describe('maxDateDecorator', () => {
it('should not error in allocationDate property with null value.',
() => {
let formGroup = formBuilder.formGroup(User);
expect(formGroup.controls.allocationDate.errors).toBeNull();
});
describe('Decorator', () => {
let formBuilder = new RxFormBuilder();
beforeEach(() => {
ReactiveFormConfig.set({
"validationMessage": {
"password": "Invalid Password",
}
});
});
describe('passwordDecorator', () => {
it("Should not error, password decorator ",
() => {
let loginInfo = new LoginInfo();
loginInfo.newPassword = undefined;
let formGroup = formBuilder.formGroup(loginInfo);
describe('Decorator', () => {
let formBuilder = new RxFormBuilder();
beforeEach(() => {
ReactiveFormConfig.set({
"validationMessage": {
"allOf": "Please select all options",
}
});
});
describe('allOfDecorator', () => {
it("Should not error, allOf decorator.",
() => {
let employeeInfo = new EmployeeInfo();
let formGroup = formBuilder.formGroup(employeeInfo);
formGroup.controls.projectDomains.setValue(["ECommerce", "Banking","Educational","Gaming"]);
expect(formGroup.controls.projectDomains.errors).toBeNull();
});
describe('Decorator', () => {
let formBuilder = new RxFormBuilder();
beforeEach(() => {
ReactiveFormConfig.set({
"validationMessage": {
"mac": "Enter valid MAC address.",
}
});
});
describe('macDecorator', () => {
it("Should not error, mac decorator Conditional Expression with type 'function'",
() => {
let macAddressInfo = new MacAddressInfo();
macAddressInfo.device = 'Laptop';
let formGroup = formBuilder.formGroup(macAddressInfo);
describe('Decorator', () => {
let formBuilder = new RxFormBuilder();
beforeEach(() => {
ReactiveFormConfig.set({
"validationMessage": {
"greaterThan": "value should be greater than field",
}
});
});
describe('greaterThanDecorator', () => {
it("Should not error, greaterThan decorator If you want to apply conditional validation on 'Voter Age' then need to add 'Age' field greater than '17'.",
() => {
let user = new User();
user.age = 18;
let formGroup = formBuilder.formGroup(user);
describe('Decorator', () => {
let formBuilder = new RxFormBuilder();
beforeEach(() => {
ReactiveFormConfig.set({
"validationMessage": {
"ascii": "Please enter an ascii code",
}
});
});
describe('asciiDecorator', () => {
it("Should not error, ascii decorator If you want to apply conditional expression of type 'function'",
() => {
let user = new User ();
user.language = 'Java';
let formGroup = formBuilder.formGroup(user);
describe('Decorator', () => {
let formBuilder = new RxFormBuilder();
beforeEach(() => {
ReactiveFormConfig.set({
"validationMessage": {
"date": "enter correct date.",
},
"baseConfig": {
"dateFormat": "dmy",
"seperator": "/"
}
});
});
describe('dateDecorator', () => {
it('should not error in allocationDate property with null value.',
() => {
describe('Decorator', () => {
let formBuilder = new RxFormBuilder();
beforeEach(() => {
ReactiveFormConfig.set({
"validationMessage": {
"creditCard": "Invalid creditcard no.",
}
});
});
describe('creditCardDecorator', () => {
it("Should error, creditCard decorator Conditional Expression with type 'function'",
() => {
let user = new User();
let formGroup = formBuilder.formGroup(user);
formGroup.controls.cardType.setValue('Visa');
formGroup.controls.visaCard.setValue('1214210');
expect(formGroup.controls.visaCard.errors).toEqual({ 'creditCard': { message: 'Invalid Visa Credit Card Number.', refValues: ['1214210', 'Visa'] } });
describe('Decorator', () => {
let formBuilder = new RxFormBuilder();
beforeEach(() => {
ReactiveFormConfig.set({
"validationMessage": {
"odd": "Enter a valid odd number.",
}
});
});
describe('oddDecorator', () => {
it("Should not error, odd decorator Conditional Expression with type 'function'",
() => {
let user = new User();
user.type = 'Odd';
let formGroup = formBuilder.formGroup(user);
describe('Decorator', () => {
let formBuilder = new RxFormBuilder();
beforeEach(() => {
ReactiveFormConfig.set({
"validationMessage": {
"different": "Do not enter same inputs.",
}
});
});
describe('differentDecorator', () => {
it("Should not error, different decorator Last Name and First Name must be different",
() => {
let accountInfo = new AccountInfo();
accountInfo.firstName = 'Mukesh';
let formGroup = formBuilder.formGroup(accountInfo);