filmov
tv
20 - Run Functional Tests on API Endpoints using Chai-HTTP II - freeCodeCamp Tutorial
![preview_player](https://i.ytimg.com/vi/jXXO1fWSHys/maxresdefault.jpg)
Показать описание
Let's look at how we can use Chai to test express API routes where request queries are involved.
00:00 - Introduction
00:08 - Example Route to Test
01:14 - Testing the Route
06:50 - Challenge Solution
Concepts:
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()).
To make the request and assert on its response, the end method can be used.
Asserts non-strict equality (==) of actual and expected.
-————————————————————————————————————-
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!
00:00 - Introduction
00:08 - Example Route to Test
01:14 - Testing the Route
06:50 - Challenge Solution
Concepts:
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()).
To make the request and assert on its response, the end method can be used.
Asserts non-strict equality (==) of actual and expected.
-————————————————————————————————————-
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!