react-router-test-context

0.1.0 • Public • Published

react-router-test-context

Create a pseudo context object that duplicates React Router's context.router structure. This is useful for shallow unit testing with Enzyme.

Usage

import createRouterContext from 'react-router-test-context'
import { shallow } from 'enzyme'
 
describe('my test', () => {
  it('renders', () => {
    const context = createRouterContext()
    const wrapper = shallow(<MyComponent />, { context })
    // ...
  })
})

Package Sidebar

Install

npm i react-router-test-context

Weekly Downloads

5,915

Version

0.1.0

License

MIT

Last publish

Collaborators

  • pshrmn