What is jest?
It works with projects using: Babel, TypeScript, Node, React, Angular, Vue
How it can help us writing test cases
but as it is from react developers more inclination is there. Enzyme is another framework which is specifically designed to test react components.
Enzyme, created by Airbnb, adds some great additional utility methods for rendering a component (or multiple components), finding elements, and interacting with elements.
Why Using Jest
Automatically finds tests
Automatically mocks dependencies
Runs your tests with a fake DOM implementation
Runs tests in parallel processes
How do I know what to test?
import the function to test
give an input to the function
define what to expect as the output
check if the function produces the expected output
Facebook testing library
This is no surprise as both React and Jest come from Facebook, which is a major user of both. In this tutorial I'll show you eight different aspects of Jest that make it such a delight for testing React applications.