Skip to content

Commit

Permalink
Mock all child components
Browse files Browse the repository at this point in the history
  • Loading branch information
OzzieOrca committed May 9, 2019
1 parent a742063 commit 96fc165
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 115 deletions.
6 changes: 5 additions & 1 deletion src/containers/WelcomeScreen/__tests__/WelcomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ const next = jest.fn(() => ({ type: 'next' }));
jest.mock('react-native-device-info');
jest.mock('../../../actions/analytics');
jest.mock('../../../components/BottomButton', () => 'BottomButton');
jest.mock('../../../components/Button', () => 'Button');
jest.mock('../../../components/common', () => ({
Flex: 'Flex',
Text: 'Text',
Button: 'Button',
}));

// @ts-ignore
common.disableBack = { add: jest.fn(), remove: jest.fn() };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,78 +10,52 @@ exports[`WelcomeScreen should render correctly 1`] = `
}
}
>
<View
<Flex
align="center"
justify="center"
style={
Array [
Object {
"paddingHorizontal": 60,
},
Object {
"alignItems": "center",
"flex": 1,
"justifyContent": "center",
},
]
Object {
"paddingHorizontal": 60,
}
}
value={1}
>
<View
style={
Array [
Object {},
Object {
"alignItems": "flex-start",
"flex": 3,
"justifyContent": "center",
},
]
}
<Flex
align="start"
justify="center"
value={3}
>
<Text
style={
Array [
Object {
"color": "#505256",
},
Object {
"fontFamily": "AmaticSC-Bold",
},
Object {
"color": "#52C5DC",
"fontSize": 48,
},
]
Object {
"color": "#52C5DC",
"fontSize": 48,
}
}
type="header"
>
welcome!
</Text>
<Text
style={
Array [
Object {
"color": "#505256",
},
Object {
"fontFamily": "SourceSansPro-Regular",
},
Object {
"color": "#ffffff",
"fontSize": 24,
"lineHeight": 32,
"paddingVertical": 10,
"textAlign": "left",
},
]
Object {
"color": "#ffffff",
"fontSize": 24,
"lineHeight": 32,
"paddingVertical": 10,
"textAlign": "left",
}
}
>
Growing closer to God involves helping others experience Him. MissionHub joins you in that journey by suggesting steps of faith to take with others.
</Text>
</View>
</Flex>
<BottomButton
onPress={[Function]}
testID="get-started"
text="Let's Get Started"
/>
</View>
</Flex>
</RCTSafeAreaView>
`;

Expand All @@ -95,83 +69,50 @@ exports[`WelcomeScreen should render correctly with sign in button 1`] = `
}
}
>
<View
<Flex
align="center"
justify="center"
style={
Array [
Object {
"paddingHorizontal": 60,
},
Object {
"alignItems": "center",
"flex": 1,
"justifyContent": "center",
},
]
Object {
"paddingHorizontal": 60,
}
}
value={1}
>
<View
style={
Array [
Object {},
Object {
"alignItems": "flex-start",
"flex": 3,
"justifyContent": "center",
},
]
}
<Flex
align="start"
justify="center"
value={3}
>
<Text
style={
Array [
Object {
"color": "#505256",
},
Object {
"fontFamily": "AmaticSC-Bold",
},
Object {
"color": "#52C5DC",
"fontSize": 48,
},
]
Object {
"color": "#52C5DC",
"fontSize": 48,
}
}
type="header"
>
welcome!
</Text>
<Text
style={
Array [
Object {
"color": "#505256",
},
Object {
"fontFamily": "SourceSansPro-Regular",
},
Object {
"color": "#ffffff",
"fontSize": 24,
"lineHeight": 32,
"paddingVertical": 10,
"textAlign": "left",
},
]
Object {
"color": "#ffffff",
"fontSize": 24,
"lineHeight": 32,
"paddingVertical": 10,
"textAlign": "left",
}
}
>
Growing closer to God involves helping others experience Him. MissionHub joins you in that journey by suggesting steps of faith to take with others.
</Text>
</View>
<View
style={
Array [
Object {},
Object {
"alignItems": "center",
"flex": 1,
"justifyContent": "flex-start",
},
]
}
</Flex>
<Flex
align="center"
justify="start"
value={1}
>
<Button
buttonTextStyle={
Expand Down Expand Up @@ -221,7 +162,7 @@ exports[`WelcomeScreen should render correctly with sign in button 1`] = `
testID="try-it-now"
text="TRY IT NOW"
/>
</View>
</View>
</Flex>
</Flex>
</RCTSafeAreaView>
`;

0 comments on commit 96fc165

Please sign in to comment.