npm.io
0.1.0 • Published 9 years ago

react-router-test-context

Licence
MIT
Version
0.1.0
Deps
0
Vulns
0
Weekly
0
Stars
48

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 })
    // ...
  })
})

Keywords