Skip to content

Instantly share code, notes, and snippets.

@alexbrillant
Created February 16, 2017 00:35
Show Gist options
  • Save alexbrillant/1b0a79bb6cc45cee3318cc130a705282 to your computer and use it in GitHub Desktop.
Save alexbrillant/1b0a79bb6cc45cee3318cc130a705282 to your computer and use it in GitHub Desktop.
Circle transition animation jest test
import 'react-native'
import React from 'react'
import CircleTransition from '../CircleTransition.js'
// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer'
const positionTest = (position) => {
const tree = renderer.create(
<CircleTransition
color={'orange'}
position={position}
expand
callback={() => {
console.log('transition done callback')
}}
customLeftMargin={100}
customTopMargin={100}
/>
).toJSON()
expect(tree).toMatchSnapshot()
}
it('renders correctly with default props', () => {
const tree = renderer.create(
<CircleTransition callback={() => {
console.log('transition done callback')
}} />
)
})
it('renders correctly when position is center', () => {
positionTest('center')
})
// other positions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment