📸 Add basic snapshot test.

This commit is contained in:
Dylan Vann 2017-04-17 19:50:22 -04:00
parent 6abeb860c8
commit 2ec252446d
5 changed files with 1047 additions and 104 deletions

4
.babelrc Normal file
View File

@ -0,0 +1,4 @@
{
"presets": ["react-native"]
}

20
FastImage.test.js Normal file
View File

@ -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()
})

View File

@ -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",
}
}
/>
`;

View File

@ -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"
]
}
}

1089
yarn.lock

File diff suppressed because it is too large Load Diff