react-component-tape-util

1.0.2 • Public • Published

react-component-tape-util Build Status

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')
})

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    14
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    14
  • 1.0.1
    4
  • 0.0.1
    3

Package Sidebar

Install

npm i react-component-tape-util

Weekly Downloads

16

Version

1.0.2

License

ISC

Last publish

Collaborators

  • mattroylloyd