Skip to content

Commit ecabe90

Browse files
authored
Merge pull request #13 from Naturalclar/chore/addTesting
chore: add snapshot tests
2 parents ae90179 + 1ca9520 commit ecabe90

File tree

6 files changed

+1286
-553
lines changed

6 files changed

+1286
-553
lines changed

.circleci/config.yml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ orbs:
3939
jobs:
4040
# Set up a Linux environment for downstream jobs
4141
linux-checkout:
42-
executor: rn/linux_js
42+
executor:
43+
name: rn/linux_js
44+
node_version: '10'
4345
steps:
4446
- attach_workspace:
4547
at: .
@@ -50,28 +52,36 @@ jobs:
5052
paths: .
5153

5254
eslint:
53-
executor: rn/linux_js
55+
executor:
56+
name: rn/linux_js
57+
node_version: '10'
5458
steps:
5559
- attach_workspace:
5660
at: .
5761
- run: *eslint
5862

5963
type-check:
60-
executor: rn/linux_js
64+
executor:
65+
name: rn/linux_js
66+
node_version: '10'
6167
steps:
6268
- attach_workspace:
6369
at: .
6470
- run: *type-check
6571

6672
flow:
67-
executor: rn/linux_js
73+
executor:
74+
name: rn/linux_js
75+
node_version: '10'
6876
steps:
6977
- attach_workspace:
7078
at: .
7179
- run: *flow
7280

7381
jest:
74-
executor: rn/linux_js
82+
executor:
83+
name: rn/linux_js
84+
node_version: '10'
7585
steps:
7686
- attach_workspace:
7787
at: .
@@ -128,11 +138,10 @@ workflows:
128138
# TODO: implement typescript types
129139
# - type-check:
130140
# requires:
131-
# - linux-checkout
132-
# TODO: implement test
133-
# - jest:
134-
# requires:
135-
# - linux-checkout
141+
# - linux-checkout
142+
- jest:
143+
requires:
144+
- linux-checkout
136145
- flow:
137146
requires:
138147
- 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)