react-better-testdeprecated

Better React test utils

Usage no npm install needed!

<script type="module">
  import reactBetterTest from 'https://cdn.skypack.dev/react-better-test';
</script>

README

react-better-test

Better React test utils npm version CircleCI Coverage Status


Installation

npm i -D react-better-test styled-components react-test-renderer redux react-redux react-router enzyme.

Usage

import renderer from 'react-better-test'
import 'jest-styled-components'
import Adapter from 'enzyme-adapter-react-16'
import enzyme from 'enzyme'
enzyme.configure({ adapter: new Adapter() })

// ...
expect(renderer.create(<Foo />)).toMatchSnapshot()
expect(renderer.mount(<SomeStyledComponent />)).toHaveStyleRule('color', 'blue')

See the tests for full usage examples.

TODO:

  • Finish Flow
  • Fix skipped tests

License

MIT