RUVIDEO
Поделитесь видео 🙏

React Testing Library for Beginners: React.js Testing Tutorial #3

In this video we'll learn how to use react testing library to query elements from the DOM and interact with those elements. We also use the user-events package from the react testing library ecosystem to make our interactions easier!

In the initial part of this video we will be adding tests to an existent component.

In the second part of the video, we will add a new feature to our component using TDD (Test Driven Development)

react testing library = @testing-library/react npm package

----
All the videos in this series (React.js Testing Tutorial): https://www.youtube.com/playlist?list=PLYSZyzpwBEWTBdbfStjqJSGaulqcHoNkT
----
Join the channel to support my content:
https://www.youtube.com/channel/UCyU0mNYdX9EHY7rc5yucIZA/join
----

----
GitHub Repository: https://github.com/bmvantunes/youtube-react-testing-video3-introduction-jest-react-testing-library
----

----
Playground: https://testing-playground.com/
React Testing Library Query Priority: https://testing-library.com/docs/queries/about/#priority
----

----
Video where we built the counter component: https://youtu.be/Mz2siLaajyE
----



From their docs:
--------
The React Testing Library is a very light-weight solution for testing React components. It provides light utility functions on top of react-dom and react-dom/test-utils, in a way that encourages better testing practices. Its primary guiding principle is:

So rather than dealing with instances of rendered React components, your tests will work with actual DOM nodes. The utilities this library provides facilitate querying the DOM in the same way the user would. Finding form elements by their label text (just like a user would), finding links and buttons from their text (like a user would). It also exposes a recommended way to find elements by a data-testid as an "escape hatch" for elements where the text content and label do not make sense or is not practical.

This library encourages your applications to be more accessible and allows you to get your tests closer to using your components the way a user will, which allows your tests to give you more confidence that your application will work when a real user uses it.
-------

Timeline:
00:00 Agenda
01:03 TDD: Red, Green, Refactor
02:30 Intro to React Testing Library
03:45 The more your tests resemble the way your software is used,
the more confidence they can give you.
04:32 Queries and Priority
05:45 Automated Query Selector for us: Playground
07:27 Code
23:00 TDD: New Feature

----
#react #jest #ReactTestingLibrary
----

Follow me on:
Twitter: https://twitter.com/bmvantunes
Dev.to: https://dev.to/bmvantunes
Website: https://brunoantunes.net
GitHub: https://github.com/bmvantunes
LinkedIn: https://www.linkedin.com/in/bmvantunes

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «React Testing Library for Beginners: React.js Testing Tutorial #3», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.