jest-enzyme-matchers
Enzyme specific jest matchers
Installation
- Add package
npm install jest-enzyme-matchers --save-dev
- Add
testFrameworkScriptFile
Set up a setupTestFrameworkScriptFile
.
Create that file and add it to the jest configuration.
- Add matchers to Jest
In that testFrameworkScriptFile
file, import the matchers and add them to jest
expect // more expect.extend calls for your own matcheres// expect.extend({ /* ... */ })
Usage
toRender(selector)
Passes when at least one element matching the selector
is found in the wrapper.
toRenderElementTimes(selector, times)
Passes when the number of elements matching the selector
found in the wrapper matches times
exactly.