Writing our first scenario

Next, we'll write our first scenario and steps. As a reminder, the scenario is "If the client sends a POST request to /users with an empty payload, our API should respond with a 400 Bad Request HTTP status code, and a JSON object payload containing an appropriate error message".

Feature: Create User  Clients should be able to send a request to our API in order to create a  user. Our API should also validate the structure of the payload and respond  with an error if it is invalid.  Scenario: Empty Payload  If the client sends a POST request to /users with a unsupported payload, it  should receive a response with a 4xx status code.  When the client creates a POST request to /users  And attaches a generic empty payload And ...

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.