react-component-tape-util
v1.0.2
Published
Tape wrapper to test React components without all of that boilerplate
Downloads
1
Maintainers
Readme
react-component-tape-util
A tape wrapper for testing React components.
This package ties together react-addons-test-utils
and tape-jsx-equals
for your React testing. The default export is Tape with jsxEquals()
added to the test object. The renderJsx
export is a function that will render JSX components that can then
be checked with the jsxEquals
test.
npm install react-component-tape-util
Usage
import React from 'react'
import test, { renderJsx } from 'react-component-tape-util'
const HelloWorld = () => <h1>Hello, world!</h1>
test('component.HelloWorld', assert => {
const expected = <h1>Hello, world!</h1>
const actual = renderJsx(<HelloWorld />)
// jsxEquals is now included in the assert library
assert.jsxEquals(actual, expected, 'should render correctly')
})