Skip to content

Commit 021f7ff

Browse files
committed
chore: add snapshot tests
1 parent ae90179 commit 021f7ff

File tree

6 files changed

+1271
-548
lines changed

6 files changed

+1271
-548
lines changed

.circleci/config.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,10 @@ workflows:
128128
# TODO: implement typescript types
129129
# - type-check:
130130
# requires:
131-
# - linux-checkout
132-
# TODO: implement test
133-
# - jest:
134-
# requires:
135-
# - linux-checkout
131+
# - linux-checkout
132+
- jest:
133+
requires:
134+
- linux-checkout
136135
- flow:
137136
requires:
138137
- linux-checkout

example/__tests__/App.js

Lines changed: 0 additions & 15 deletions
This file was deleted.
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 ProgressView from '../ProgressViewIOS.ios';
4+
5+
describe('<ProgressView />', () => {
6+
it('renders enabled ProgressView', () => {
7+
const tree = renderer.create(<ProgressView />).toJSON();
8+
9+
expect(tree).toMatchSnapshot();
10+
});
11+
12+
it('renders Horizontal ProgressView', () => {
13+
const tree = renderer.create(<ProgressView progressViewStyle="bar" />).toJSON();
14+
15+
expect(tree).toMatchSnapshot();
16+
});
17+
18+
it('renders ProgressView with tintColor', () => {
19+
const tree = renderer.create(<ProgressView progressTintColor="red" />).toJSON();
20+
21+
expect(tree).toMatchSnapshot();
22+
});
23+
});
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`<ProgressView /> renders Horizontal ProgressView 1`] = `
4+
<RNCProgressView
5+
progressViewStyle="bar"
6+
style={
7+
Array [
8+
Object {
9+
"height": 2,
10+
},
11+
undefined,
12+
]
13+
}
14+
/>
15+
`;
16+
17+
exports[`<ProgressView /> renders ProgressView with tintColor 1`] = `
18+
<RNCProgressView
19+
progressTintColor="red"
20+
style={
21+
Array [
22+
Object {
23+
"height": 2,
24+
},
25+
undefined,
26+
]
27+
}
28+
/>
29+
`;
30+
31+
exports[`<ProgressView /> renders enabled ProgressView 1`] = `
32+
<RNCProgressView
33+
style={
34+
Array [
35+
Object {
36+
"height": 2,
37+
},
38+
undefined,
39+
]
40+
}
41+
/>
42+
`;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"run:ios": "node node_modules/react-native/local-cli/cli.js run-ios --project-path \"./example/ios\"",
1111
"start": "node node_modules/react-native/local-cli/cli.js start --projectRoot example --watchFolders $PWD",
1212
"flow": "flow",
13+
"test":"jest",
1314
"lint": "eslint ."
1415
},
1516
"peerDependencies": {
@@ -27,7 +28,7 @@
2728
"eslint": "^6.8.0",
2829
"eslint-plugin-prettier": "^3.1.2",
2930
"flow-bin": "0.105.2",
30-
"jest": "24.7.1",
31+
"jest": "^25.1.0",
3132
"metro-react-native-babel-preset": "0.53.1",
3233
"prettier": "^1.19.1",
3334
"react": "16.8.3",

0 commit comments

Comments
 (0)