📸 Add basic snapshot test.
This commit is contained in:
parent
6abeb860c8
commit
2ec252446d
|
@ -0,0 +1,20 @@
|
|||
import 'react-native'
|
||||
import React from 'react'
|
||||
import renderer from 'react-test-renderer'
|
||||
import FastImage from './FastImage.js'
|
||||
|
||||
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,
|
||||
}}
|
||||
/>
|
||||
).toJSON()
|
||||
|
||||
expect(tree).toMatchSnapshot()
|
||||
})
|
|
@ -0,0 +1,18 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`FastImage renders correctly. 1`] = `
|
||||
<FastImageView
|
||||
onFastImageError={[Function]}
|
||||
onFastImageLoad={[Function]}
|
||||
resizeMode="cover"
|
||||
source={
|
||||
Object {
|
||||
"headers": Object {
|
||||
"token": "someToken",
|
||||
},
|
||||
"priority": "high",
|
||||
"uri": "https://facebook.github.io/react/img/logo_og.png",
|
||||
}
|
||||
}
|
||||
/>
|
||||
`;
|
20
package.json
20
package.json
|
@ -14,7 +14,7 @@
|
|||
"url": "https://github.com/DylanVann/react-native-fast-image/issues"
|
||||
},
|
||||
"license": "MIT",
|
||||
"author": "Dylan Vann",
|
||||
"author": "Dylan Vann <dylanvann@gmail.com> (http://dylanvann.com)",
|
||||
"main": "FastImage.js",
|
||||
"directories": {
|
||||
"example": "example"
|
||||
|
@ -25,15 +25,21 @@
|
|||
},
|
||||
"scripts": {
|
||||
"format": "prettier --write --no-semi --single-quote --trailing-comma all ./FastImage.js",
|
||||
"test": "jest"
|
||||
"test": "jest *.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-jest": "19.0.0",
|
||||
"babel-preset-react-native": "1.9.1",
|
||||
"jest": "^19.0.2",
|
||||
"prettier": "^1.1.0",
|
||||
"react": "^15.4.0",
|
||||
"react-native": "^0.40.0"
|
||||
"react": "16.0.0-alpha.6",
|
||||
"react-native": "0.43.3",
|
||||
"react-test-renderer": "16.0.0-alpha.6"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=15.4.0",
|
||||
"react-native": ">=0.40"
|
||||
"jest": {
|
||||
"preset": "react-native",
|
||||
"modulePathIgnorePatterns": [
|
||||
"example"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue