Skip to content

Instantly share code, notes, and snippets.

@lomse
Last active October 11, 2018 00:30
Show Gist options
  • Save lomse/5f5f86f7d2a9560b61c7c2f0f460fc13 to your computer and use it in GitHub Desktop.
Save lomse/5f5f86f7d2a9560b61c7c2f0f460fc13 to your computer and use it in GitHub Desktop.
Snapshot testing with Enzyme
import React from 'react'
import Enzyme, { shallow } from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
import TodoList from './TodoList'
describe('TodoList Component', () => {
beforeAll(() => {
Enzyme.configure({ adapter: new Adapter() })
})
it('renders correctly', () => {
const component = shallow(<TodoList />)
expect(component).toMatchSnapshot()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment