Checking the payload property's format

Lastly, the email address field may be present and have the correct data type, but it may still not be a valid email. So, the final check is to ensure the email is a valid email address. You should get the drill by now: define a new feature inside spec/cucumber/features/users/create/main.feature, and check back here for the solution:

Scenario Outline: Request Payload with invalid email format  When the client creates a POST request to /users  And attaches a Create User payload where the email field is exactly <email>  And sends the request  Then our API should respond with a 400 HTTP status code  And the payload of the response should be a JSON object And contains a message property which says "The email ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.