Mutation Testing

Learn how to test a mutation request.

We'll cover the following

Testing our request

Testing a mutation doesn’t look a whole lot different from testing a query. We’ll be passing some variables, shaped to match our :menu_item_input input object type. The only real change is to use POST since that’s the HTTP method that GraphQL expects for mutations. We’ll open a new test file and drop in our createMenuItem mutation:

Execution steps:

  1. Click on the Run button for the execution of the test.
  2. No need to write any command in the console we have already set up everything.

Get hands-on with 1400+ tech skills courses.