File tree Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Expand file tree Collapse file tree 2 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+ exports [` shallow rendering React Test Instance 1` ] = `
4+ <TouchableOpacity
5+ onPress = { [Function ]}
6+ testID = " button"
7+ >
8+ <Text
9+ testID = " text-button"
10+ >
11+ Press me
12+ </Text >
13+ </TouchableOpacity >
14+ ` ;
15+
16+ exports [` shallow rendering React elements 1` ] = `
17+ <View
18+ testID = " root"
19+ >
20+ <TouchableOpacity
21+ onPress = { [Function ]}
22+ testID = " button"
23+ >
24+ <Text
25+ testID = " text-button"
26+ >
27+ Press me
28+ </Text >
29+ </TouchableOpacity >
30+ </View >
31+ ` ;
Original file line number Diff line number Diff line change 1+ // @flow
2+ import React from 'react' ;
3+ import { View , TouchableOpacity , Text } from '../__mocks__/reactNativeMock' ;
4+ import { shallow , render } from '..' ;
5+
6+ const OnPressComponent = ( { onPress } ) => (
7+ < View testID = "root" >
8+ < TouchableOpacity onPress = { onPress } testID = "button" >
9+ < Text testID = "text-button" > Press me</ Text >
10+ </ TouchableOpacity >
11+ </ View >
12+ ) ;
13+
14+ test ( 'shallow rendering React elements' , ( ) => {
15+ const { output } = shallow ( < OnPressComponent onPress = { jest . fn } /> ) ;
16+
17+ expect ( output ) . toMatchSnapshot ( ) ;
18+ } ) ;
19+
20+ test ( 'shallow rendering React Test Instance' , ( ) => {
21+ const { getByTestId } = render ( < OnPressComponent onPress = { jest . fn } /> ) ;
22+ const { output } = shallow ( getByTestId ( 'root' ) ) ;
23+
24+ expect ( output ) . toMatchSnapshot ( ) ;
25+ } ) ;
You can’t perform that action at this time.
0 commit comments