Skip to content

Instantly share code, notes, and snippets.

@oieduardorabelo
Forked from stipsan/App-test.jsx
Last active June 16, 2017 09:46
Show Gist options
  • Save oieduardorabelo/492eb6b8282c0b2ea1c8a5e93be0370f to your computer and use it in GitHub Desktop.
Save oieduardorabelo/492eb6b8282c0b2ea1c8a5e93be0370f to your computer and use it in GitHub Desktop.
Testando com Jest: Dica #7
import renderer from 'react-test-renderer'
import App from '../App'
// O snapshot gerado é extamente igual ao exemplo anterior
// É possível sobrescrever o nosso mock padrão
// usando o mesmo método jest.mock, caso esse teste
// precise de um comportamento diferente
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