Created
December 1, 2019 20:39
-
-
Save jvanderen1/5e619fc0d415eb30f15c643a888f88ea to your computer and use it in GitHub Desktop.
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
// Imports | |
// ------- | |
// Libraries | |
import React from 'react'; | |
import renderer from 'react-test-renderer'; | |
// Components | |
import { MyComponent } from '.../My-Component'; | |
// Mocks | |
// ----- | |
jest.mock('...', () => '...'); | |
// Internal | |
// -------- | |
const defaultProps = { | |
... | |
}; | |
// | |
const getComponent = (props) => renderer.create( | |
<MyComponent {...{ ...defaultProps, ...props }} />, | |
); | |
// Tests | |
// ----- | |
describe('.../My-Component', () => { | |
let component; | |
describe('Rendering', () => { | |
it('renders default correctly', () => { | |
component = getComponent(); | |
expect(component).toMatchSnapshot(); | |
}); | |
... | |
}); | |
describe('Lifecycle', () => { | |
... | |
}); | |
describe('Interaction', () => { | |
... | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment