Articles Related
List
- https://github.com/airbnb/enzyme - Enzyme is a testing library which gives you the ability to render React components in memory or to the DOM while providing a jQuery-like API for traversing the react component tree.
- https://github.com/kentcdodds/react-testing-library - wrapper around test-utils - react-testing-library provides a simple API rendering react components in html element and performing simple queries on the generated output.
If you do not want to run your tests inside of a browser, the recommended approach to using mount is to depend on a library called jsdom
Workbench
Testing component framework are called workbench. Example: React - Storybook (Component workbench)
Shallow rendering
shallow rendering lets you render a component “one level deep” and assert facts about what its render method returns, without worrying about the behavior of child components, which are not instantiated or rendered. This does not require a DOM.
watch
watch mode. Every time you save a file, it will re-run the tests
Snapshot
With Snapshot testing, we keep a file copy of the structure of UI components. Think of it like a set of HTML sources. Then, after we’ve completed any UI changes, we compare new snapshots with the snapshots that we kept in the file.
A React test renderer that output React components as pure JavaScript objects (No DOM or a native mobile environment dependency) -
It's useful to grab a snapshot of the platform view hierarchy (similar to a DOM tree) rendered by a React DOM or React Native component without using a browser or jsdom.
You can use Jest’s snapshot testing feature to automatically save a copy of the JSON tree to a file and check in your tests that it hasn’t changed
StoryShots is an integration between Storybook and Jest Snapshot Testing.