Skip to content

Commit d366aa0

Browse files
author
Ethan Neff
committed
updated dependencies and tests
1 parent e489367 commit d366aa0

File tree

8 files changed

+893
-821
lines changed

8 files changed

+893
-821
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pbxproj -text

package.json

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,35 @@
88
"ios": "react-native run-ios",
99
"android": "react-native run-android",
1010
"test": "jest --coverage",
11-
"lint": "tslint -c tslint.json 'src/**/*.ts{,x}'",
11+
"lint": "tslint -p tsconfig.json -c tslint.json",
1212
"rebuild": "rm -rf ios; rm -rf android; react-native upgrade; rm -f .babelrc; rm -f .buckconfig; rm -f .flowconfig; rm -f .watchmanconfig; rm -f .gitattributes;"
1313
},
1414
"dependencies": {
15-
"react": "^16.4.0",
16-
"react-dom": "^16.4.0",
17-
"react-native": "0.55.4",
18-
"react-native-web": "^0.8.3",
15+
"react": "^16.4.1",
16+
"react-dom": "^16.4.1",
17+
"react-native": "0.56.0",
18+
"react-native-web": "^0.8.8",
1919
"react-scripts-ts": "^2.16.0"
2020
},
2121
"devDependencies": {
22-
"@types/jest": "^23.0.0",
23-
"@types/react": "^16.3.17",
24-
"@types/react-native": "^0.55.17",
22+
"@types/jest": "^23.3.0",
23+
"@types/react": "^16.4.6",
24+
"@types/react-native": "^0.56.3",
2525
"@types/react-test-renderer": "^16.0.1",
26-
"babel-jest": "23.0.1",
26+
"babel-jest": "23.4.0",
2727
"babel-preset-react-native": "4.0.0",
28-
"jest": "23.1.0",
29-
"prettier": "^1.13.4",
30-
"react-art": "^16.4.0",
31-
"react-native-typescript-transformer": "^1.2.9",
32-
"react-test-renderer": "^16.4.0",
33-
"ts-jest": "^22.4.6",
34-
"typescript": "^2.9.1"
28+
"jest": "23.4.1",
29+
"prettier": "^1.13.7",
30+
"react-art": "^16.4.1",
31+
"react-native-typescript-transformer": "^1.2.10",
32+
"react-test-renderer": "^16.4.1",
33+
"ts-jest": "^23.0.1",
34+
"typescript": "^2.9.2"
3535
},
3636
"babel": {
37-
"presets": ["react-native"]
37+
"presets": [
38+
"react-native"
39+
]
3840
},
3941
"jest": {
4042
"preset": "react-native",

src/components/Hello/__tests__/__snapshots__/index.tsx.snap

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`renders correctly with defaults 1`] = `
3+
exports[`Hello renders correctly with defaults 1`] = `
44
<View
55
style={
66
Object {
@@ -10,9 +10,6 @@ exports[`renders correctly with defaults 1`] = `
1010
}
1111
>
1212
<Text
13-
accessible={true}
14-
allowFontScaling={true}
15-
ellipsizeMode="tail"
1613
style={
1714
Object {
1815
"color": "#999",
@@ -69,9 +66,6 @@ exports[`renders correctly with defaults 1`] = `
6966
}
7067
>
7168
<Text
72-
accessible={true}
73-
allowFontScaling={true}
74-
ellipsizeMode="tail"
7569
style={
7670
Array [
7771
Object {
@@ -126,9 +120,6 @@ exports[`renders correctly with defaults 1`] = `
126120
}
127121
>
128122
<Text
129-
accessible={true}
130-
allowFontScaling={true}
131-
ellipsizeMode="tail"
132123
style={
133124
Array [
134125
Object {

src/components/Hello/__tests__/index.tsx

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,35 @@ import * as React from "react";
22
import { create } from "react-test-renderer";
33
import Hello from "../";
44

5-
it("renders correctly with defaults", () => {
6-
const button = create(<Hello name="World" enthusiasmLevel={1} />).toJSON();
7-
expect(button).toMatchSnapshot();
5+
describe("Hello", () => {
6+
it("renders correctly with defaults", () => {
7+
const button = create(<Hello name="World" enthusiasmLevel={1} />).toJSON();
8+
expect(button).toMatchSnapshot();
9+
});
10+
11+
it("increments", () => {
12+
const button = create(
13+
<Hello name="World" enthusiasmLevel={1} />
14+
).getInstance();
15+
button.onIncrement();
16+
button.onIncrement();
17+
expect(button.state.enthusiasmLevel).toBe(3);
18+
});
19+
20+
it("decrements", () => {
21+
const button = create(
22+
<Hello name="World" enthusiasmLevel={4} />
23+
).getInstance();
24+
button.onDecrement();
25+
button.onDecrement();
26+
expect(button.state.enthusiasmLevel).toBe(2);
27+
});
28+
29+
it("decrements at zero", () => {
30+
const button = create(
31+
<Hello name="World" enthusiasmLevel={0} />
32+
).getInstance();
33+
button.onDecrement();
34+
expect(button.state.enthusiasmLevel).toBe(0);
35+
});
836
});

src/components/Hello/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ interface IState {
3232
class Hello extends React.Component<IProps, IState> {
3333
constructor(props: IProps) {
3434
super(props);
35-
if ((props.enthusiasmLevel || 0) <= 0) {
36-
throw new Error("You could be a little more enthusiastic. :D");
37-
}
35+
3836
this.state = {
3937
enthusiasmLevel: props.enthusiasmLevel || 1
4038
};

src/containers/App/__tests__/__snapshots__/index.tsx.snap

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ exports[`renders correctly 1`] = `
1212
}
1313
>
1414
<Text
15-
accessible={true}
16-
allowFontScaling={true}
17-
ellipsizeMode="tail"
1815
style={
1916
Object {
2017
"fontSize": 20,
@@ -26,9 +23,6 @@ exports[`renders correctly 1`] = `
2623
Welcome to React Native!
2724
</Text>
2825
<Text
29-
accessible={true}
30-
allowFontScaling={true}
31-
ellipsizeMode="tail"
3226
style={
3327
Object {
3428
"color": "#333333",
@@ -37,12 +31,9 @@ exports[`renders correctly 1`] = `
3731
}
3832
}
3933
>
40-
To get started, edit App.js
34+
To get started, edit ./src/containers/App/index.tsx
4135
</Text>
4236
<Text
43-
accessible={true}
44-
allowFontScaling={true}
45-
ellipsizeMode="tail"
4637
style={
4738
Object {
4839
"color": "#333333",
@@ -63,9 +54,6 @@ Cmd+D or shake for dev menu
6354
}
6455
>
6556
<Text
66-
accessible={true}
67-
allowFontScaling={true}
68-
ellipsizeMode="tail"
6957
style={
7058
Object {
7159
"color": "#999",
@@ -75,7 +63,7 @@ Cmd+D or shake for dev menu
7563
>
7664
Hello
7765
78-
bob!
66+
Human!
7967
</Text>
8068
<View
8169
style={
@@ -122,9 +110,6 @@ Cmd+D or shake for dev menu
122110
}
123111
>
124112
<Text
125-
accessible={true}
126-
allowFontScaling={true}
127-
ellipsizeMode="tail"
128113
style={
129114
Array [
130115
Object {
@@ -179,9 +164,6 @@ Cmd+D or shake for dev menu
179164
}
180165
>
181166
<Text
182-
accessible={true}
183-
allowFontScaling={true}
184-
ellipsizeMode="tail"
185167
style={
186168
Array [
187169
Object {

tsconfig.prod.json

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

0 commit comments

Comments
 (0)