<commit_before># expect-react-shallow

[![Build Status](https://travis-ci.org/sapegin/expect-react-shallow.svg)](https://travis-ci.org/sapegin/expect-react-shallow)

A [Chai’s](http://chaijs.com) expect like API wrapper for [unexpected-react-shallow](https://github.com/bruderstein/unexpected-react-shallow). It also accepts JSX instead of ShallowRenderer instance.

![expect-react-shallow](https://s3.amazonaws.com/f.cl.ly/items/1M3a3B163l392G1N3v25/Screen%20Shot%202015-11-12%20at%2022.39.57.png)


## Installation

```shell
npm install --save-dev expect-react-shallow
```


## Usage

```js
import React from 'react';
import { expect } from 'mocha';
import expectReactShallow from 'expect-react-shallow';

class TestComponent extends React.Component {
	render() {
		return <div className="foo">Hello React!</div>;
	}
}

describe('TestComponent', () => {

  it('works', () => {
	expectReactShallow(<TestComponent/>).to.have.rendered(<div>Hello React!</div>);  // OK

	expectReactShallow(<TestComponent/>).to.have.exactly.rendered(<div className="foo">Hello React!</div>)  // OK

	expectReactShallow(<TestComponent/>).to.have.exactly.rendered(<div/>)  // Error

	expectReactShallow(<TestComponent/>).to.contain(<div/>)  // OK
  });

});
```


## API

```js
expectReactShallow(ReactComponent|JSX).to.have.rendered(ReactComponent|JSX);
expectReactShallow(ReactComponent|JSX).to.have.rendered.with.all.children(ReactComponent|JSX);
expectReactShallow(ReactComponent|JSX).to.have.exactly.rendered(ReactComponent|JSX);
expectReactShallow(ReactComponent|JSX).to.contain(ReactComponent|JSX);
expectReactShallow(ReactComponent|JSX).to.contain.exactly(ReactComponent|JSX);
```

See details in [unexpected-react-shallow docs](https://github.com/bruderstein/unexpected-react-shallow#assertions).


## Changelog

The changelog can be found in the [Changelog.md](Changelog.md) file.


## Contributing

Everyone is welcome to contribute. Please take a moment to review the [contributing guidelines](Contributing.md).


## Author

* [<NAME>](http://sapegin.me)
<commit_msg>Fix changelog link.<commit_after># expect-react-shallow

[![Build Status](https://travis-ci.org/sapegin/expect-react-shallow.svg)](https://travis-ci.org/sapegin/expect-react-shallow)

A [Chai’s](http://chaijs.com) expect like API wrapper for [unexpected-react-shallow](https://github.com/bruderstein/unexpected-react-shallow). It also accepts JSX instead of ShallowRenderer instance.

![expect-react-shallow](https://s3.amazonaws.com/f.cl.ly/items/1M3a3B163l392G1N3v25/Screen%20Shot%202015-11-12%20at%2022.39.57.png)


## Installation

```shell
npm install --save-dev expect-react-shallow
```


## Usage

```js
import React from 'react';
import { expect } from 'mocha';
import expectReactShallow from 'expect-react-shallow';

class TestComponent extends React.Component {
	render() {
		return <div className="foo">Hello React!</div>;
	}
}

describe('TestComponent', () => {

  it('works', () => {
	expectReactShallow(<TestComponent/>).to.have.rendered(<div>Hello React!</div>);  // OK

	expectReactShallow(<TestComponent/>).to.have.exactly.rendered(<div className="foo">Hello React!</div>)  // OK

	expectReactShallow(<TestComponent/>).to.have.exactly.rendered(<div/>)  // Error

	expectReactShallow(<TestComponent/>).to.contain(<div/>)  // OK
  });

});
```


## API

```js
expectReactShallow(ReactComponent|JSX).to.have.rendered(ReactComponent|JSX);
expectReactShallow(ReactComponent|JSX).to.have.rendered.with.all.children(ReactComponent|JSX);
expectReactShallow(ReactComponent|JSX).to.have.exactly.rendered(ReactComponent|JSX);
expectReactShallow(ReactComponent|JSX).to.contain(ReactComponent|JSX);
expectReactShallow(ReactComponent|JSX).to.contain.exactly(ReactComponent|JSX);
```

See details in [unexpected-react-shallow docs](https://github.com/bruderstein/unexpected-react-shallow#assertions).


## Changelog

The changelog can be found on the [Releases page](https://github.com/sapegin/expect-react-shallow/releases).


## Contributing

Everyone is welcome to contribute. Please take a moment to review the [contributing guidelines](Contributing.md).


## Author

* [<NAME>](http://sapegin.me)

{'fraction_non_alphanumeric': 0.1653051417587698, 'fraction_numerical': 0.017299375300336376, 'mean_word_length': 5.824590163934427, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 33, 'https://': 11, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2292198', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1441, 'n_words': 206}