Current refValueFor functionality does not use the configured error message coming from "refValueFor" in the error messages section.
A good example would be the test 'confirm-password.test.js'
Change config to be:
config = {
logging: true,
// for error messages...
errMessages: {
confirmPassword: {
refValueFor: "confirm password field must have the same value as password",
required: "this field is required"
}
}
};
Add in two new tests:
it('is invalid if blank and displays required message', async () => {
try {
schema.validateSync({ username: "jimmy", "password": "xyz123", "confirmPassword": "" });
} catch (e) {
expect(e.errors[0]).toBe('this field is required');
}
})
it('is invalid if if confirmPassword does not match password', async () => {
try {
schema.validateSync({ username: "jimmy", "password": "xyz123", "confirmPassword": "xyz1234" });
} catch (e) {
expect(e.errors[0]).toBe('confirm password field must have the same value as password');
// however confirmPassword must be one of the following values: Ref(password) is returned
}
})
Hello All
Current refValueFor functionality does not use the configured error message coming from "refValueFor" in the error messages section.
A good example would be the test 'confirm-password.test.js'
Change config to be:
Add in two new tests:
I've fixed this locally by going:
'mixed.js'
replace:
with: