Skip to content

Instantly share code, notes, and snippets.

@stipsan
Last active June 16, 2017 09:44
Show Gist options
  • Save stipsan/b2d3a254f6878d3b3dfa0d6bdf790a06 to your computer and use it in GitHub Desktop.
Save stipsan/b2d3a254f6878d3b3dfa0d6bdf790a06 to your computer and use it in GitHub Desktop.
Testing with Jest: Tip #7
import renderer from 'react-test-renderer'
import App from '../App'
// Generated snapshot is exactly like the previous example
// while it's possible to override the default mock
// by using the same jest.mock command as before
// if this test need a different behavior than the
// glboal mock.
it('should render correctly', () => {
const component = renderer.create(<App />)
expect(component.toJSON()).toMatchSnapshot()
})
export const Router = ({ children, ...props }) =>
typeof children === 'function'
? children({ match: path === '/somewhere' })
: createElement('Route', props)
export const Link = 'Link'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment