Last active
June 16, 2017 09:44
-
-
Save stipsan/b2d3a254f6878d3b3dfa0d6bdf790a06 to your computer and use it in GitHub Desktop.
Testing with Jest: Tip #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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