-
-
Save oieduardorabelo/492eb6b8282c0b2ea1c8a5e93be0370f to your computer and use it in GitHub Desktop.
Testando com Jest: Dica #7
This file contains 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' | |
// 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() | |
}) |
This file contains 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