Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Mocking React Components and Functions using Jest for Beginners - React.js Testing Tutorial #5

Автор: Bruno Antunes

Загружено: 2021-08-09

Просмотров: 67124

Описание:

In this tutorial we are going to learn how to mock components and functions using the built-in features in jest.

We will use jest.mock, jest.spyOn, jest.fn(), _mocks_ folder and others.

Manual mocks are used to stub out functionality with mock data. For example, instead of accessing a remote resource like a website or a database, you might want to create a manual mock that allows you to use fake data. This ensures your tests will be fast and not flaky.

Mock functions allow you to test the links between code by erasing the actual implementation of a function, capturing calls to the function (and the parameters passed in those calls), capturing instances of constructor functions when instantiated with new, and allowing test-time configuration of return values.

There are two ways to mock functions: Either by creating a mock function to use in test code, or writing a manual mock to override a module dependency.

----
GitHub repository: https://github.com/bmvantunes/youtube...
----
All the videos in this series (React.js Testing Tutorial):    • React.js Unit Testing and Integration Test...  
----
Join the channel to support my content:
   / @brunoantunespt  
-----
Timeline:
00:00 Intro
00:18 Example 1
06:55 Example 2a: Button
09:40 Example 2b: Data Grid
17:00 Example 3
19:50 Example 4
22:06 Example 5: Avoid mocking everywhere the same component
25:50 Outro
----

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

#jest #ReactTestingLibrary #react

Mocking React Components and Functions using Jest for Beginners - React.js Testing Tutorial #5

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Mock HTTP calls using Fetch or Axios - Mock Service Worker - React.js Testing Tutorial #6

Mock HTTP calls using Fetch or Axios - Mock Service Worker - React.js Testing Tutorial #6

Дмитрий Винник. Тестирование React приложений c Jest: проверяйте свои компоненты быстро!

Дмитрий Винник. Тестирование React приложений c Jest: проверяйте свои компоненты быстро!

Тестирование JavaScript от А до Я (Jest, React Testing Library, e2e, screenshot)

Тестирование JavaScript от А до Я (Jest, React Testing Library, e2e, screenshot)

Mocking Asynchronous Functions with Jest

Mocking Asynchronous Functions with Jest

12 - React + TypeScript / Jest, Unit Test для Thunk / React JS - Путь Самурая 2.0

12 - React + TypeScript / Jest, Unit Test для Thunk / React JS - Путь Самурая 2.0

Mock vs Spy in Testing with Jest: Which is Better?

Mock vs Spy in Testing with Jest: Which is Better?

React Vite Testing Tutorial For Beginners - Vitest Testing Crash Course

React Vite Testing Tutorial For Beginners - Vitest Testing Crash Course

React Testing for Beginners: Start Here!

React Testing for Beginners: Start Here!

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

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

Unbelievable Workers | Working with Talented Engineers . EP6 #construction #adamrose #workers #smart

Unbelievable Workers | Working with Talented Engineers . EP6 #construction #adamrose #workers #smart

Next.js 15 Unit Testing with Jest and React Testing Library | Test Driven Development

Next.js 15 Unit Testing with Jest and React Testing Library | Test Driven Development

Unit Testing Next.js Router - useRouter - React.js Testing Tutorial #9

Unit Testing Next.js Router - useRouter - React.js Testing Tutorial #9

React Async Testing using React Testing Library for Beginners: React.js Testing Tutorial #4

React Async Testing using React Testing Library for Beginners: React.js Testing Tutorial #4

Most Ridiculous Worker Mistakes Caught on Camera

Most Ridiculous Worker Mistakes Caught on Camera

Забудь VS Code — Вот Почему Все Переходят на Cursor AI

Забудь VS Code — Вот Почему Все Переходят на Cursor AI

Zod Validation in React (Complete Tutorial)

Zod Validation in React (Complete Tutorial)

JavaScript Testing Basics with Jest

JavaScript Testing Basics with Jest

Mastering React's useEffect

Mastering React's useEffect

React Testing Library Tutorial #13 - Mocking Requests

React Testing Library Tutorial #13 - Mocking Requests

Testing React Forms - React Testing Library - React.js Testing Tutorial #8

Testing React Forms - React Testing Library - React.js Testing Tutorial #8

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: infodtube@gmail.com