Skip to content

Instantly share code, notes, and snippets.

@skellock
Created June 27, 2016 12:59
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 skellock/05831d1fa976e903c155e9140f5f7256 to your computer and use it in GitHub Desktop.
Save skellock/05831d1fa976e903c155e9140f5f7256 to your computer and use it in GitHub Desktop.
import test from 'ava'
import React from 'react'
import Button from '../Button'
import { shallow } from 'enzyme'
test('component structure', t => {
const wrapper = shallow(<Button onPress={() => {}} text='hi' />)
t.is(wrapper.name(), 'TouchableOpacity') // root component
t.is(wrapper.children().length, 1) // has 1 child
t.is(wrapper.children().first().name(), 'Text')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment