11import * as React from 'react'
2- import { Button } from 'react-native'
2+ import { Text , TouchableOpacity } from 'react-native'
33import * as TestRenderer from 'react-test-renderer'
44import { useRefresh } from '../../..'
55
@@ -11,10 +11,9 @@ test('does not refresh the component before the returned function is invoked', (
1111 const refresh = useRefresh ( )
1212
1313 return (
14- < Button
15- onPress = { refresh }
16- title = { `${ invocations . current } Invocation(s)` }
17- />
14+ < TouchableOpacity onPress = { refresh } >
15+ < Text > { `${ invocations . current } Invocation(s)` } </ Text >
16+ </ TouchableOpacity >
1817 )
1918 }
2019
@@ -23,7 +22,11 @@ test('does not refresh the component before the returned function is invoked', (
2322 expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
2423 expect . objectContaining ( {
2524 props : expect . objectContaining ( {
26- title : '1 Invocation(s)'
25+ children : expect . objectContaining ( {
26+ props : expect . objectContaining ( {
27+ children : '1 Invocation(s)'
28+ } )
29+ } )
2730 } )
2831 } )
2932 )
@@ -39,10 +42,9 @@ test('refreshes the component the first time that the returned function is invok
3942 const refresh = useRefresh ( )
4043
4144 return (
42- < Button
43- onPress = { refresh }
44- title = { `${ invocations . current } Invocation(s)` }
45- />
45+ < TouchableOpacity onPress = { refresh } >
46+ < Text > { `${ invocations . current } Invocation(s)` } </ Text >
47+ </ TouchableOpacity >
4648 )
4749 }
4850
@@ -57,7 +59,11 @@ test('refreshes the component the first time that the returned function is invok
5759 expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
5860 expect . objectContaining ( {
5961 props : expect . objectContaining ( {
60- title : '2 Invocation(s)'
62+ children : expect . objectContaining ( {
63+ props : expect . objectContaining ( {
64+ children : '2 Invocation(s)'
65+ } )
66+ } )
6167 } )
6268 } )
6369 )
@@ -73,10 +79,9 @@ test('refreshes the component the second time that the returned function is invo
7379 const refresh = useRefresh ( )
7480
7581 return (
76- < Button
77- onPress = { refresh }
78- title = { `${ invocations . current } Invocation(s)` }
79- />
82+ < TouchableOpacity onPress = { refresh } >
83+ < Text > { `${ invocations . current } Invocation(s)` } </ Text >
84+ </ TouchableOpacity >
8085 )
8186 }
8287
@@ -97,7 +102,11 @@ test('refreshes the component the second time that the returned function is invo
97102 expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
98103 expect . objectContaining ( {
99104 props : expect . objectContaining ( {
100- title : '3 Invocation(s)'
105+ children : expect . objectContaining ( {
106+ props : expect . objectContaining ( {
107+ children : '3 Invocation(s)'
108+ } )
109+ } )
101110 } )
102111 } )
103112 )
0 commit comments