2018-02-01 01:27:36 +00:00
|
|
|
import { StyleSheet } from 'react-native'
|
2017-04-17 23:50:22 +00:00
|
|
|
import React from 'react'
|
|
|
|
import renderer from 'react-test-renderer'
|
|
|
|
import FastImage from './FastImage.js'
|
|
|
|
|
2018-02-01 01:27:36 +00:00
|
|
|
const style = StyleSheet.create({ image: { width: 44, height: 44 } })
|
|
|
|
|
2017-04-17 23:50:22 +00:00
|
|
|
test('FastImage renders correctly.', () => {
|
2017-04-28 15:31:58 +00:00
|
|
|
const tree = renderer
|
|
|
|
.create(
|
|
|
|
<FastImage
|
|
|
|
source={{
|
|
|
|
uri: 'https://facebook.github.io/react/img/logo_og.png',
|
|
|
|
headers: {
|
|
|
|
token: 'someToken',
|
|
|
|
},
|
|
|
|
priority: FastImage.priority.high,
|
|
|
|
}}
|
2018-02-01 01:27:36 +00:00
|
|
|
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}
|
2017-04-28 15:31:58 +00:00
|
|
|
/>,
|
|
|
|
)
|
|
|
|
.toJSON()
|
2017-04-17 23:50:22 +00:00
|
|
|
|
|
|
|
expect(tree).toMatchSnapshot()
|
|
|
|
})
|