# react-test-utilities

> Testing Utilities for React

Latest version **0.1.0** (published 2015-12-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-test-utilities
pnpm add react-test-utilities
yarn add react-test-utilities
bun add react-test-utilities
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2015-12-01 |
| First published | 2015-08-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Allan Hortle |
| Maintainers | allanhortle |
| Keywords | react, test, testing, jsx |

## Links

- npm: https://www.npmjs.com/package/react-test-utilities
- npm.io page: https://npm.io/package/react-test-utilities

## Dependencies (2)

- [react-dom](https://npm.io/package/react-dom.md) ^0.14.3
- [object-assign](https://npm.io/package/object-assign.md) ^2.0.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-12-01
- 0.0.3 — 2015-08-10
- 0.0.2 — 2015-08-10
- 0.0.1 — 2015-08-09

## README

# react-test-utilities

Testing utilities for react.

```
npm install --save-dev react-test-utilities
```

 * [renderAndFind()](#user-content-renderandfindcomponent)
 * [stubRouterContext()](#user-content-stubroutercontextcomponent-props-stubs)


### `renderAndFind(Component)`
Renders a component into dom and returns that node.

```jsx
var dom = renderAndFind(<Component/>);
expect(dom.text).toBe('Hello World.');
```


### `stubRouterContext(Component, props, stubs)`
Stubs react-router's `this.router.context` so you can test components that rely on it.

```jsx
import someReactRouterDependantComponent from 'components/someReactRouterDependantComponent';

var Subject = stubRouterContext(someReactRouterDependantComponent); 
var dom = renderAndFind(<Subject/>);
expect(someAssertion).toBe(true);
```

---
_Source: https://npm.io/package/react-test-utilities · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
