Skip to content

Instantly share code, notes, and snippets.

@arshmakker
Created April 13, 2020 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arshmakker/0df579b45bd668bc8596605c0dcc7e16 to your computer and use it in GitHub Desktop.
Save arshmakker/0df579b45bd668bc8596605c0dcc7e16 to your computer and use it in GitHub Desktop.
Button.test.js
import React from 'react'
import Button from '../components/Button'
import renderer from 'react-test-renderer'
const classButton = "sampleClass"
const title = "Sample Title"
it("Renders the Button correctly with no props ", () => {
const tree = renderer
.create(<Button/>)
.toJSON();
expect(tree).toMatchSnapshot();
})
it("Renders the Button correctly with test props", () => {
const tree = renderer
.create(<Button classButton={classButton}
title={title} ></Button>)
.toJSON();
expect(tree).toMatchSnapshot();
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment