Skip to content

Instantly share code, notes, and snippets.

@IsTheJack
Created April 18, 2019 16:55
Show Gist options
  • Save IsTheJack/d36119fb5ea9fc1ba4ed96c1cbe3531c to your computer and use it in GitHub Desktop.
Save IsTheJack/d36119fb5ea9fc1ba4ed96c1cbe3531c to your computer and use it in GitHub Desktop.
Simple component test using Jest, React DOM and React
// This file should be named as Button.spec.tsx
import * as React from 'react'
import * as ReactDOM from 'react-dom'
import Button from './'
describe('component Button', () => {
it('renders without crashing', () => {
const div = document.createElement('div')
ReactDOM.render(<Button />, div)
ReactDOM.unmountComponentAtNode(div)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment