Skip to content
This repository has been archived by the owner on Aug 6, 2020. It is now read-only.

Latest commit

 

History

History
55 lines (40 loc) · 1.09 KB

tape-ava.md

File metadata and controls

55 lines (40 loc) · 1.09 KB

Using Enzyme with Tape and AVA

Enzyme works well with Tape and AVA. Simply install it and start using it:

npm i --save-dev enzyme

Tape

import test from 'tape'
import React from 'react'
import { shallow, mount } from 'enzyme';

import Foo from '../path/to/foo'

test('shallow', t => {
  const wrapper = shallow(<Foo />)
  t.equal(wrapper.contains(<span>Foo</span>), true)
})

test('mount', t => {
  const wrapper = mount(<Foo />)
  const fooInner = wrapper.find('.foo-inner')
  t.equal(fooInner.is('.foo-inner'), true)
})

AVA

import test from 'ava'
import React from 'react'
import { shallow, mount } from 'enzyme';

import Foo from '../path/to/foo'

test('shallow', t => {
  const wrapper = shallow(<Foo />)
  t.is(wrapper.contains(<span>Foo</span>), true)
})

test('mount', t => {
  const wrapper = mount(<Foo />)
  const fooInner = wrapper.find('.foo-inner')
  t.is(fooInner.is('.foo-inner'), true)
})

Example Projects