https://github.com/bigpipe/assume-enzyme
Improved assertions when using Enzyme
https://github.com/bigpipe/assume-enzyme
assume enzyme expect react react-native test testing
Last synced: about 2 months ago
JSON representation
Improved assertions when using Enzyme
- Host: GitHub
- URL: https://github.com/bigpipe/assume-enzyme
- Owner: bigpipe
- Created: 2017-04-18T12:53:15.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-18T13:41:04.000Z (about 9 years ago)
- Last Synced: 2025-03-21T00:09:04.075Z (over 1 year ago)
- Topics: assume, enzyme, expect, react, react-native, test, testing
- Language: JavaScript
- Size: 11.7 KB
- Stars: 0
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# 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.
```bash
npm install --save-dev assume-enzyme
```
## API
- [enzyme](#enzyme)
- [className, classNames](#classname-classnames)
- [contain, contains](#contain-contains)
- [tagName](#tagName)
- [checked](#checked)
- [disabled](#disabled)
- [props](#props)
#### enzyme
Assert that a given value is an enzyme instance.
```js
function Example() {
return (
);
}
wrapper = shallow();
assume(wrapper).is.enzyme();
```
#### className, classNames
Assert that a given component has the supplied classNames.
```js
function Example() {
return (
);
}
wrapper = shallow();
assume(wrapper).to.have.className('hello');
assume(wrapper).to.have.className('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.
```js
function Example() {
return (
);
}
wrapper = shallow();
assume(wrapper).to.have.tagName('div');
```
#### checked
Assert that a given input is checked or not.
```js
function Example() {
return (
);
}
wrapper = shallow();
assume(wrapper).is.checked();
```
#### disabled
Assert that a given input is disabled or not.
```js
function Example() {
return (
);
}
wrapper = shallow();
assume(wrapper).is.disabled();
```
#### props
Assert that a component has a given set of props assigned to it.
```js
```
## License
MIT