react-native-fast-image/FastImage.test.js

39 lines
895 B
JavaScript

import { StyleSheet } from 'react-native'
import React from 'react'
import renderer from 'react-test-renderer'
import FastImage from './FastImage.js'
const style = StyleSheet.create({ image: { width: 44, height: 44 } })
test('FastImage renders correctly.', () => {
const tree = renderer
.create(
<FastImage
source={{
uri: 'https://facebook.github.io/react/img/logo_og.png',
headers: {
token: 'someToken',
},
priority: FastImage.priority.high,
}}
style={style.image}
/>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})
test('Renders a normal Image when not passed a uri.', () => {
const tree = renderer
.create(
<FastImage
source={require('./server/pictures/jellyfish.gif')}
style={style.image}
/>,
)
.toJSON()
expect(tree).toMatchSnapshot()
})