Skip to content

Instantly share code, notes, and snippets.

@lomse
Last active October 20, 2018 15:10
Show Gist options
  • Save lomse/ee9e4f4fafb8ee561c58a618edafb5e3 to your computer and use it in GitHub Desktop.
Save lomse/ee9e4f4fafb8ee561c58a618edafb5e3 to your computer and use it in GitHub Desktop.
Snapshot test for TodoItem component with Enzyme
import React from "react"
import Enzyme, { shallow } from "enzyme"
import Adapter from "enzyme-adapter-react-16"
import TodoItem from "./TodoItem"
describe("TodoItem Component", () => {
beforeAll(() => {
Enzyme.configure({ adapter: new Adapter() })
})
it("renders correctly", () => {
const component = shallow(<TodoItem id={1} title="Do house chores" />)
expect(component).toMatchSnapshot()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment