Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests #5

Open
wants to merge 9 commits into
base: 0.2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"presets": [
"env",
"react",
"react-native"
],
"env": {
"test": {
"presets": [
"env",
"react",
"react-native"
],
"plugins": [
"transform-class-properties"
]
}
}
}
9 changes: 8 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Don't export images
# Don't export the following files
/img export-ignore
/__tests__ export-ignore
/node_modules export-ignore
.travis.ymp export-ignore
.gitignore export-ignore
.gitattributes export-ignore
.babelrc export-ignore
.npmignore export-ignore
# Gif are binaries
*.gif binary
# Don't conflict with package-lock file
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
node_modules
.idea/
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js
node_js:
- "7"
env:
- NODE_ENV=test
script: npm run test
cache:
directories:
- "node_modules"
1 change: 0 additions & 1 deletion ImagePlaceholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
ActivityIndicator,
Image,
StyleSheet,
Text,
View,
Animated
} from "react-native";
Expand Down
13 changes: 13 additions & 0 deletions __tests__/ImagePlaceholder.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import ImagePlaceholder from './../ImagePlaceholder';
import renderer from 'react-test-renderer';


describe( 'ImagePlaceholder', () => {
it( 'renders correctly the component', () => {
const tree = renderer
.create( <ImagePlaceholder /> )
.toJSON();
expect( tree ).toMatchSnapshot();
} );
} )
79 changes: 79 additions & 0 deletions __tests__/__snapshots__/ImagePlaceholder.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ImagePlaceholder renders correctly the component 1`] = `
<View
style={
Array [
Object {
"alignSelf": "stretch",
"flex": 1,
},
undefined,
]
}
>
<View
style={
Object {
"alignItems": "center",
"alignSelf": "stretch",
"bottom": 0,
"flex": 1,
"justifyContent": "center",
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
"zIndex": 2,
}
}
>
<Image
resizeMode="cover"
source={
Object {
"uri": undefined,
}
}
style={
Array [
Object {
"alignSelf": "stretch",
"bottom": 0,
"flex": 1,
"left": 0,
"position": "absolute",
"right": 0,
"top": 0,
"zIndex": 2,
},
undefined,
]
}
/>
<ActivityIndicator
animating={true}
color="#999999"
hidesWhenStopped={true}
size="small"
/>
</View>
<Image
onProgress={[Function]}
resizeMode="cover"
source={
Object {
"uri": undefined,
}
}
style={
Array [
Object {
"flex": 1,
},
undefined,
]
}
/>
</View>
`;
Loading