Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
const messages = {
'age.required': 'Age is required',
'phone.required': function () {
return 'Phone number is required for validations'
}
}
try {
const passed = await Validator.validateAll(body, rules, messages)
assert.notExist(passed)
} catch (e) {
assert.isArray(e)
assert.equal(e[0].message, messages['age.required'])
assert.equal(e[1].message, messages['phone.required']())
}
})