19 - Run Functional Tests on API Endpoints using Chai-HTTP - freeCodeCamp Tutorial
We can integrate Chai testing into our APIs and Express Apps using a plugin called chai-http. This allows Chai to send requests to our application and perform assertion tests on the response.
Link to Challenge : https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-api-endpoints-using-chai-http
Written Guide: https://www.notion.so/ganeshh123/Run-Functional-Tests-on-API-Endpoints-using-Chai-HTTP-980d60a2434f4acaa5674538e35a2f98
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
00:00 - Introduction
00:10 - Setting up Express Project for Chai Testing
04:02 - Running Chai tests on Express App Routes
04:38 - 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
05:28 - 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
06:02 - Testing the Response with assert methods
09:05 - Challenge Solution
-————————————————————————————————————-
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!
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «19 - Run Functional Tests on API Endpoints using Chai-HTTP - freeCodeCamp Tutorial», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.