-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Adding more component jest snapshots #30
Changes from 1 commit
2c3000d
7fda7ae
e5732e4
ceed977
59ed95d
0cf20ba
60ce394
2926d9c
2ad694f
4ec934a
1170dc4
a4290da
8416143
f3c0081
bf976c4
17daf30
aac14c4
2646ea3
f8f6a47
02b6958
94db968
bd354cc
f8f718c
47f3899
951427b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react"; | ||
import NavigationTestUtils from "react-navigation/NavigationTestUtils"; | ||
import { shallow } from "enzyme"; | ||
import EthereumQuestion from "./EthereumQuestion"; | ||
|
||
describe("EthereumQuestion", () => { | ||
jest.useFakeTimers(); | ||
beforeEach(() => { | ||
NavigationTestUtils.resetInternalState(); | ||
}); | ||
|
||
it("renders the component", async () => { | ||
expect(shallow(<EthereumQuestion />)).toMatchSnapshot(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react"; | ||
import NavigationTestUtils from "react-navigation/NavigationTestUtils"; | ||
import { shallow } from "enzyme"; | ||
import EthereumSignIn from "./EthereumSignIn"; | ||
|
||
describe("EthereumSignIn", () => { | ||
jest.useFakeTimers(); | ||
beforeEach(() => { | ||
NavigationTestUtils.resetInternalState(); | ||
}); | ||
|
||
it("renders the component", async () => { | ||
expect(shallow(<EthereumSignIn />)).toMatchSnapshot(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react"; | ||
import NavigationTestUtils from "react-navigation/NavigationTestUtils"; | ||
import { shallow } from "enzyme"; | ||
import EthereumSignUp from "./EthereumSignUp"; | ||
|
||
describe("EthereumSignUp", () => { | ||
jest.useFakeTimers(); | ||
beforeEach(() => { | ||
NavigationTestUtils.resetInternalState(); | ||
}); | ||
|
||
it("renders the component", async () => { | ||
expect(shallow(<EthereumSignUp />)).toMatchSnapshot(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react"; | ||
import NavigationTestUtils from "react-navigation/NavigationTestUtils"; | ||
import { shallow } from "enzyme"; | ||
import Home from "./Home"; | ||
|
||
describe("Home", () => { | ||
jest.useFakeTimers(); | ||
beforeEach(() => { | ||
NavigationTestUtils.resetInternalState(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @marcelomorgado I think for any screens that also happen to be presentational (that don't have any internal state or lifecycle hooks), we probably don't need to import On that topic, would it be easier to keep track of which screens are presentational if we moved most of their content to a presentational component and then made the "screen" just render that presentational component? I'm inclined to say yes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right. Yes, make sense.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hey @pcowgill what do you think? EthereumQuestionScreen
EthereumQuestion
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks great! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feel free to make changes like this one throughout the repo |
||
}); | ||
|
||
it("renders the component", async () => { | ||
expect(shallow(<Home />)).toMatchSnapshot(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from "react"; | ||
import NavigationTestUtils from "react-navigation/NavigationTestUtils"; | ||
import { shallow } from "enzyme"; | ||
import LandClaim from "./LandClaim"; | ||
|
||
describe("LandClaim", () => { | ||
jest.useFakeTimers(); | ||
beforeEach(() => { | ||
NavigationTestUtils.resetInternalState(); | ||
}); | ||
|
||
it("renders the component", async () => { | ||
const navigation = { getParam: jest.fn() }; | ||
pcowgill marked this conversation as resolved.
Show resolved
Hide resolved
|
||
expect(shallow(<LandClaim navigation={navigation} />)).toMatchSnapshot(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the snapshot / test split would be more readable if there were a presentational component for most of the jsx in LandClaim that had a shallow snapshot test with no navigation mock, and then this screen shallow-rendered itself with the name of that component like it does now, but the snapshot would be much smaller. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I agree. 👍 |
||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react"; | ||
import NavigationTestUtils from "react-navigation/NavigationTestUtils"; | ||
import { shallow } from "enzyme"; | ||
import ListLands from "./ListLands"; | ||
|
||
describe("EthereumQuestion", () => { | ||
jest.useFakeTimers(); | ||
beforeEach(() => { | ||
NavigationTestUtils.resetInternalState(); | ||
}); | ||
|
||
it("renders the component", async () => { | ||
expect(shallow(<ListLands />)).toMatchSnapshot(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react"; | ||
import NavigationTestUtils from "react-navigation/NavigationTestUtils"; | ||
import { shallow } from "enzyme"; | ||
import OnboardingHome from "./OnboardingHome"; | ||
|
||
describe("OnboardingHome", () => { | ||
jest.useFakeTimers(); | ||
beforeEach(() => { | ||
NavigationTestUtils.resetInternalState(); | ||
}); | ||
|
||
it("renders the component", async () => { | ||
expect(shallow(<OnboardingHome />)).toMatchSnapshot(); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EthereumQuestion renders the component 1`] = ` | ||
<Component | ||
style={ | ||
Object { | ||
"alignItems": "center", | ||
"backgroundColor": "#fff", | ||
"flex": 1, | ||
"justifyContent": "center", | ||
} | ||
} | ||
> | ||
<LargeText> | ||
Are you new to Ethereum? | ||
</LargeText> | ||
<Component | ||
style={ | ||
Object { | ||
"flexDirection": "row", | ||
"marginTop": 20, | ||
} | ||
} | ||
> | ||
<Button | ||
onPress={[Function]} | ||
title="Yep" | ||
/> | ||
</Component> | ||
<Component | ||
style={ | ||
Object { | ||
"flexDirection": "row", | ||
"marginTop": 20, | ||
} | ||
} | ||
> | ||
<Button | ||
onPress={[Function]} | ||
title="Nope" | ||
/> | ||
</Component> | ||
</Component> | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EthereumSignIn renders the component 1`] = ` | ||
<Component | ||
style={ | ||
Object { | ||
"alignItems": "center", | ||
"backgroundColor": "#fff", | ||
"flex": 1, | ||
"justifyContent": "center", | ||
} | ||
} | ||
> | ||
<LargeText> | ||
Cool. Let's start by hooking this app with your wallet. | ||
</LargeText> | ||
<Component | ||
style={ | ||
Object { | ||
"flexDirection": "row", | ||
"marginTop": 30, | ||
} | ||
} | ||
> | ||
<Button | ||
onPress={[Function]} | ||
title="Connect with WalletConnect" | ||
/> | ||
</Component> | ||
</Component> | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EthereumSignUp renders the component 1`] = ` | ||
<KeyboardAvoidingView | ||
behavior="padding" | ||
enabled={true} | ||
keyboardVerticalOffset={84} | ||
style={ | ||
Object { | ||
"alignItems": "center", | ||
"backgroundColor": "#fff", | ||
"flex": 1, | ||
"justifyContent": "center", | ||
} | ||
} | ||
> | ||
<LargeText> | ||
Cool. Let's start by picking your Tasit username. | ||
</LargeText> | ||
<EthereumSignUpForm /> | ||
</KeyboardAvoidingView> | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Home renders the component 1`] = ` | ||
<Component | ||
style={ | ||
Object { | ||
"alignItems": "center", | ||
"backgroundColor": "#fff", | ||
"flex": 1, | ||
"justifyContent": "center", | ||
} | ||
} | ||
> | ||
<Component | ||
source={1} | ||
/> | ||
<LargeText> | ||
Tasit | ||
</LargeText> | ||
<Button | ||
onPress={[Function]} | ||
title="Decentraland" | ||
/> | ||
</Component> | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`LandClaim renders the component 1`] = ` | ||
<Component | ||
style={ | ||
Object { | ||
"alignItems": "center", | ||
"backgroundColor": "#fff", | ||
"flex": 1, | ||
"justifyContent": "center", | ||
} | ||
} | ||
> | ||
<Land /> | ||
<Component | ||
style={ | ||
Object { | ||
"flexDirection": "row", | ||
"marginTop": 30, | ||
} | ||
} | ||
> | ||
<Button | ||
onPress={[Function]} | ||
title="Claim" | ||
/> | ||
</Component> | ||
</Component> | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EthereumQuestion renders the component 1`] = ` | ||
<ListViewMock | ||
renderRow={[Function]} | ||
renderScrollComponent={[MockFunction]} | ||
style={ | ||
Object { | ||
"backgroundColor": "#fff", | ||
"flex": 1, | ||
} | ||
} | ||
/> | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`OnboardingHome renders the component 1`] = ` | ||
<Component | ||
style={ | ||
Object { | ||
"alignItems": "center", | ||
"backgroundColor": "#fff", | ||
"flex": 1, | ||
"justifyContent": "center", | ||
} | ||
} | ||
> | ||
<Component | ||
source={1} | ||
/> | ||
<LargeText> | ||
Let's get you set up with a secure way to store this land! | ||
</LargeText> | ||
<Component | ||
style={ | ||
Object { | ||
"flexDirection": "row", | ||
"marginTop": 30, | ||
} | ||
} | ||
> | ||
<Button | ||
onPress={[Function]} | ||
title="Get started" | ||
/> | ||
</Component> | ||
</Component> | ||
`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most pure, functional presentational components won't need to
useFakeTimers
, right?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right.