Skip to content

Commit 4ec2767

Browse files
authored
Add snapshot tests (#15)
Add snapshot tests
2 parents f6703b1 + 2264e93 commit 4ec2767

File tree

7 files changed

+2609
-375
lines changed

7 files changed

+2609
-375
lines changed

.circleci/config.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,9 @@ workflows:
175175
# - type-check:
176176
# requires:
177177
# - linux-checkout
178-
# TODO: uncomment after tests are fixed
179-
# - jest:
180-
# requires:
181-
# - linux-checkout
178+
- jest:
179+
requires:
180+
- linux-checkout
182181
- android-compile:
183182
requires:
184183
- linux-checkout

example/__tests__/App-test.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

js/RNCProgressBarAndroid.android.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ ProgressBarAndroidToExport.defaultProps = {
100100
/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an
101101
* error found when Flow v0.89 was deployed. To see the error, delete this
102102
* comment and run Flow. */
103-
module.exports = (ProgressBarAndroidToExport: ProgressBarAndroidNativeComponent);
103+
export default (ProgressBarAndroidToExport: ProgressBarAndroidNativeComponent);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import * as React from 'react';
2+
import renderer from 'react-test-renderer';
3+
import ProgressBar from '../RNCProgressBarAndroid.android';
4+
5+
describe('<ProgressBar />', () => {
6+
it('renders enabled ProgressBar', () => {
7+
const tree = renderer.create(<ProgressBar />).toJSON();
8+
9+
expect(tree).toMatchSnapshot();
10+
});
11+
12+
it('renders Horizontal ProgressBar', () => {
13+
const tree = renderer.create(<ProgressBar styleAttr="Horizontal" />).toJSON();
14+
15+
expect(tree).toMatchSnapshot();
16+
});
17+
18+
it('renders Inverse ProgressBar', () => {
19+
const tree = renderer.create(<ProgressBar typeAttr="Inverse" />).toJSON();
20+
21+
expect(tree).toMatchSnapshot();
22+
});
23+
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`<ProgressBar /> renders Horizontal ProgressBar 1`] = `
4+
<AndroidProgressBar
5+
animating={true}
6+
indeterminate={true}
7+
styleAttr="Horizontal"
8+
/>
9+
`;
10+
11+
exports[`<ProgressBar /> renders Inverse ProgressBar 1`] = `
12+
<AndroidProgressBar
13+
animating={true}
14+
indeterminate={true}
15+
styleAttr="Normal"
16+
typeAttr="Inverse"
17+
/>
18+
`;
19+
20+
exports[`<ProgressBar /> renders enabled ProgressBar 1`] = `
21+
<AndroidProgressBar
22+
animating={true}
23+
indeterminate={true}
24+
styleAttr="Normal"
25+
/>
26+
`;

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@
3434
"@babel/core": "^7.4.3",
3535
"@babel/runtime": "^7.4.3",
3636
"@react-native-community/eslint-config": "0.0.5",
37-
"babel-jest": "^24.7.1",
37+
"babel-jest": "^24.9.0",
3838
"babel-plugin-module-resolver": "^3.2.0",
3939
"eslint": "^5.16.0",
4040
"eslint-plugin-prettier": "^3.0.1",
41-
"jest": "^24.7.1",
41+
"jest": "^24.9.0",
4242
"metro-react-native-babel-preset": "^0.53.1",
4343
"prettier": "^1.17.0",
44+
"react": "16.9.0",
45+
"react-native": "^0.61.5",
4446
"react-test-renderer": "16.8.3"
4547
},
4648
"jest": {

0 commit comments

Comments
 (0)