filmov
tv
Mocking Asynchronous Functions with Jest

Показать описание
Mocking is a fundamental skill in testing. It allows you to avoid testing parts of your code that are outside your control, or to get reliable return values from said code.
00:00 - What we'll cover
01:00 - Reviewing the project setup
03:02 - Creating the test
06:24 - Adding async await to pass test
07:17 - Why mock an api request for unit tests
08:32 - Adding jest mock for axios
14:06 - Check if mock function has been called
15:31 - Shorthand for mocking resolved promise value
16:23 - Gotcha for mock state, and how to clear it each test
18:24 - Alternate way of mocking within a test file
20:50 - Wrap-up
Repository for code example:
Blog Post:
Swapi Dev:
Follow Jimmy Cleveland's doings:
#jest #mock #async
00:00 - What we'll cover
01:00 - Reviewing the project setup
03:02 - Creating the test
06:24 - Adding async await to pass test
07:17 - Why mock an api request for unit tests
08:32 - Adding jest mock for axios
14:06 - Check if mock function has been called
15:31 - Shorthand for mocking resolved promise value
16:23 - Gotcha for mock state, and how to clear it each test
18:24 - Alternate way of mocking within a test file
20:50 - Wrap-up
Repository for code example:
Blog Post:
Swapi Dev:
Follow Jimmy Cleveland's doings:
#jest #mock #async
Mocking Asynchronous Functions with Jest
Mocking Axios in Jest + Testing Async Functions
JavaScript Testing - Mocking Async Code
How to Test Asynchronous Code with Jest
Helping a subscriber learn Jest and mocking a bit
Testing Asynchronous Components with Mocks in Jest
Jest Asynchronous Testing - Mocking Promises
Mocking a Database in Node with Jest
JavaScript Testing with Jest – Crash Course
Jest Crash Course - Learn How to Test your JavaScript Application
How to Mock Fetch in Jest Manually
React Testing Tutorial - 43 - Mocking HTTP Requests
NodeJS : How to mock nested function in Jest?
React Testing Tutorial - 42 - Mocking Functions
jest-mock: все лгут?
Mock vs Spy in Testing with Jest: Which is Better?
How to Mock a REST API Server for Testing with Jest & React Testing Library
Test Timing-Based JavaScript Functions with Jest
Mocking an API call using jest (jest.mock('axios'), mockResolvedValue)
Mocking React Components and Functions using Jest for Beginners - React.js Testing Tutorial #5
Testing Async code with Jest
JavaScript Callbacks Explained in 5 Minutes (Essential for asynchronous code!)
11 Get Started With Jest Mocks
How to Test Asynchronous Code in Python
Комментарии