Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jeremija/react-testing
Reduces boilerplate code when testing React components
https://github.com/jeremija/react-testing
Last synced: 9 days ago
JSON representation
Reduces boilerplate code when testing React components
- Host: GitHub
- URL: https://github.com/jeremija/react-testing
- Owner: jeremija
- License: other
- Created: 2016-12-18T23:36:06.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-19T02:03:32.000Z (almost 8 years ago)
- Last Synced: 2024-10-07T11:38:40.686Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 18.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# react-testing
[![Build Status](https://travis-ci.org/jeremija/react-testing.svg?branch=master)][1]
Reduces boilerplate code when testing React components.
# Usage
Rendering using `react-addons-test-utils`:
```javascript
const { React, render } = require('react-testing');
const MyComponent = require('../MyComponent.jsx');
describe('MyComponent', () => {
it('should render without problems', () => {
const { component, node } = render(
test
);
expect(component.props.className).toBe('my-class');
expect(node.textContent).toBe('test');
});
});
```Rendering using `react-test-renderer`:
```javascript
const { React, renderPure } = require('react-testing');
const MyComponent = require('../MyComponent.jsx');
describe('MyComponent', () => {
it('should render without problems', () => {
const obj = renderPure(
test
);
expect(obj.toJSON().children).toEqual(['test']);
});
});
```# License
[ISC][2][1]: https://travis-ci.org/jeremija/react-testing
[2]: https://opensource.org/licenses/ISC