assume-enzyme
The assume-enzyme
module provides a more human readable API and assertion
output when using Enzyme in your test suite.
Installation
The module is published to the public npm registry and should be installed a dev dependency.
npm install --save-dev assume-enzyme
API
enzyme
Assert that a given value is an enzyme instance.
{ return <div className='hello world'></div> ;} wrapper = ;is;
className, classNames
Assert that a given component has the supplied classNames.
{ return <div className='hello world'></div> ;} wrapper = ;tohaveclassName'hello';tohaveclassName'world';
contain, contains
Assert that a given wrapper contains a given component. While this method
overrides the default contains
and contain
methods it will still work as
expected as this functionality is only triggered if we're passed in a enzyme
instance.
tagName
Assert that a component has a given tag name.
{ return <div className='hello world'></div> ;} wrapper = ;tohavetagName'div';
checked
Assert that a given input is checked or not.
{ return <input id='hello' defaultChecked /> ;} wrapper = ;ischecked;
disabled
Assert that a given input is disabled or not.
{ return <input id='hello' disabled /> ;} wrapper = ;isdisabled;
props
Assert that a component has a given set of props assigned to it.
License
MIT