Setup Block for Testing JSON-based APIs
Get familiarized with the basic structure and setup block for testing JSON-based APIs.
We'll cover the following
Testing the update endpoint
In the included repo, NotSkull, let’s create a new test file at test/not_skull_web/controllers/json_api/user_controller_test.exs
.
Note: We’ve added nesting under
json_api
to avoid conflicting with the tests for the user controller that we used for the server-rendered HTML endpoint.
The following code will add a basic structure and setup block to the file we created:
Get hands-on with 1400+ tech skills courses.