request.validate not raise error in test #4173
-
Hi, the request.validate does not raise an exception when i send a invalid form on tests. If i remove await from request.validate its works. export default class SignupController {
} And the tests: test('test user register', async ({ client }) => {
}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @crisnamurti If you remove When you provide bad datas at your validator, |
Beta Was this translation helpful? Give feedback.
Hello @crisnamurti
If you remove
await
of yourrequest.validate
, node doesn't wait for the response ofrequest.validate
and pass automatically at the next line. Concretly it doesn't validate your request.When you provide bad datas at your validator,
request.validate
will respond with a http 422 error with the reasons of the validation fail, but not raise an exeption.