Quality Assurance and Testing with Chai - Run Functional Tests on an API Response using Chai-HTTP III - PUT method

As a reminder, this project is being built upon the following starter project on Glitch, or cloned from GitHub.

In the next example we'll see how to send data in a request payload (body).

We are going to test a PUT request. The '/travellers' endpoint accepts

a JSON object taking the structure :

{surname: [last name of a traveller of the past]} ,

The route responds with :

{name: [first name], surname:[last name], dates: [birth - death years]}

see the server code for more details.

Send {surname: 'Colombo'}. Replace assert.fail() and make the test pass.

Check for 1) status, 2) type, 3) body.name, 4) body.surname

Follow the assertion order above, We rely on it.

Get a hint