An open API service indexing awesome lists of open source software.

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

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