22 -  Run Functional Tests on API Response using Chai-HTTP IV - PUT method - freeCodeCamp Tutorial
Channel: Ganesh H
Date: 2020-07-27

We can combine all our previous knowledge now to setup a Chai test for a POST request from scratch.

Link to Challenge : https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iv---put-method
Written Guide: https://www.notion.so/ganeshh123/Run-Functional-Tests-on-an-API-Response-using-Chai-HTTP-IV-PUT-method-93d14401cd9a4afa922478ebf1c3ce36

Full Playlist for this course : https://www.youtube.com/playlist?list=PLhGp6N0DI_1SVteCORbgwlxJkAbcTiZyj
All Writen Guides for this course : https://www.notion.so/ganeshh123/54ecbf7833414db885eec37f580599b4
All My Tutorials can be found at : https://www.notion.so/Tutorials-Ganesh-H-293ea420d34a464f9a1907e0405b5f26

Concepts:
chai.send()
Can give an object here to add fields into the request body.
https://www.npmjs.com/package/chai-http#setting-up-requests

chai.request()
When passing an app to request; it will automatically open the server for incoming requests (by calling listen()) and, once a request has been made the server will automatically shut down (by calling .close()). 
https://www.npmjs.com/package/chai-http#application--server

chai.end()
To make the request and assert on its response, the end method can be used.
https://www.chaijs.com/plugins/chai-http/

assert.equal()
Asserts non-strict equality (==) of actual and expected.
https://www.chaijs.com/api/assert/#method_equal

-————————————————————————————————————-
Chai is an assertion library, similar to Node's built-in assert. It makes testing much easier by giving you lots of assertions you can run against your code.

freeCodeCamp (also referred to as “Free Code Camp”) is a non-profit organization that consists of an interactive learning web platform, an online community forum, chat rooms, online publications and local organizations that intend to make learning web development accessible to anyone. Beginning with tutorials that introduce students to HTML, CSS and JavaScript, students progress to project assignments that they complete either alone or in pairs. Upon completion of all project tasks, students are partnered with other nonprofits to build web applications, giving the students practical development experience.

Thanks for Watching!