11import { randomUUID } from 'crypto'
22import * as React from 'react'
3- import { Button , Text } from 'react-native'
3+ import { Text , TouchableOpacity } from 'react-native'
44import * as TestRenderer from 'react-test-renderer'
55import { createSessionStoreManagerComponent , SessionStore } from '../../..'
66
@@ -15,12 +15,13 @@ test('displays the loading screen', async () => {
1515 < SessionStoreManager
1616 loading = { < Text > Loading</ Text > }
1717 ready = { ( session , setSession ) => (
18- < Button
19- title = { `Session contains ${ session . value } ` }
18+ < TouchableOpacity
2019 onPress = { ( ) => {
2120 setSession ( { value : session . value + 1 } )
2221 } }
23- />
22+ >
23+ < Text > { `Session contains ${ session . value } ` } </ Text >
24+ </ TouchableOpacity >
2425 ) }
2526 />
2627 )
@@ -52,12 +53,13 @@ test('shows the ready screen once given time to load', async () => {
5253 < SessionStoreManager
5354 loading = { < Text > Loading</ Text > }
5455 ready = { ( session , setSession ) => (
55- < Button
56- title = { `Session contains ${ session . value } ` }
56+ < TouchableOpacity
5757 onPress = { ( ) => {
5858 setSession ( { value : session . value + 1 } )
5959 } }
60- />
60+ >
61+ < Text > { `Session contains ${ session . value } ` } </ Text >
62+ </ TouchableOpacity >
6163 ) }
6264 />
6365 )
@@ -69,7 +71,11 @@ test('shows the ready screen once given time to load', async () => {
6971 expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
7072 expect . objectContaining ( {
7173 props : expect . objectContaining ( {
72- title : 'Session contains 5'
74+ children : expect . objectContaining ( {
75+ props : expect . objectContaining ( {
76+ children : 'Session contains 5'
77+ } )
78+ } )
7379 } )
7480 } )
7581 )
@@ -91,12 +97,13 @@ test('re-renders when the session is changed externally once', async () => {
9197 < SessionStoreManager
9298 loading = { < Text > Loading</ Text > }
9399 ready = { ( session , setSession ) => (
94- < Button
95- title = { `Session contains ${ session . value } ` }
100+ < TouchableOpacity
96101 onPress = { ( ) => {
97102 setSession ( { value : session . value + 1 } )
98103 } }
99- />
104+ >
105+ < Text > { `Session contains ${ session . value } ` } </ Text >
106+ </ TouchableOpacity >
100107 ) }
101108 />
102109 )
@@ -109,7 +116,11 @@ test('re-renders when the session is changed externally once', async () => {
109116 expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
110117 expect . objectContaining ( {
111118 props : expect . objectContaining ( {
112- title : 'Session contains 6'
119+ children : expect . objectContaining ( {
120+ props : expect . objectContaining ( {
121+ children : 'Session contains 6'
122+ } )
123+ } )
113124 } )
114125 } )
115126 )
@@ -131,12 +142,13 @@ test('re-renders when the session is changed externally twice', async () => {
131142 < SessionStoreManager
132143 loading = { < Text > Loading</ Text > }
133144 ready = { ( session , setSession ) => (
134- < Button
135- title = { `Session contains ${ session . value } ` }
145+ < TouchableOpacity
136146 onPress = { ( ) => {
137147 setSession ( { value : session . value + 1 } )
138148 } }
139- />
149+ >
150+ < Text > { `Session contains ${ session . value } ` } </ Text >
151+ </ TouchableOpacity >
140152 ) }
141153 />
142154 )
@@ -150,7 +162,11 @@ test('re-renders when the session is changed externally twice', async () => {
150162 expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
151163 expect . objectContaining ( {
152164 props : expect . objectContaining ( {
153- title : 'Session contains 7'
165+ children : expect . objectContaining ( {
166+ props : expect . objectContaining ( {
167+ children : 'Session contains 7'
168+ } )
169+ } )
154170 } )
155171 } )
156172 )
@@ -172,12 +188,13 @@ test('re-renders when the session is changed internally once', async () => {
172188 < SessionStoreManager
173189 loading = { < Text > Loading</ Text > }
174190 ready = { ( session , setSession ) => (
175- < Button
176- title = { `Session contains ${ session . value } ` }
191+ < TouchableOpacity
177192 onPress = { ( ) => {
178193 setSession ( { value : session . value + 1 } )
179194 } }
180- />
195+ >
196+ < Text > { `Session contains ${ session . value } ` } </ Text >
197+ </ TouchableOpacity >
181198 ) }
182199 />
183200 )
@@ -192,7 +209,11 @@ test('re-renders when the session is changed internally once', async () => {
192209 expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
193210 expect . objectContaining ( {
194211 props : expect . objectContaining ( {
195- title : 'Session contains 6'
212+ children : expect . objectContaining ( {
213+ props : expect . objectContaining ( {
214+ children : 'Session contains 6'
215+ } )
216+ } )
196217 } )
197218 } )
198219 )
@@ -214,12 +235,13 @@ test('re-renders when the session is changed internally twice', async () => {
214235 < SessionStoreManager
215236 loading = { < Text > Loading</ Text > }
216237 ready = { ( session , setSession ) => (
217- < Button
218- title = { `Session contains ${ session . value } ` }
238+ < TouchableOpacity
219239 onPress = { ( ) => {
220240 setSession ( { value : session . value + 1 } )
221241 } }
222- />
242+ >
243+ < Text > { `Session contains ${ session . value } ` } </ Text >
244+ </ TouchableOpacity >
223245 ) }
224246 />
225247 )
@@ -237,7 +259,11 @@ test('re-renders when the session is changed internally twice', async () => {
237259 expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
238260 expect . objectContaining ( {
239261 props : expect . objectContaining ( {
240- title : 'Session contains 7'
262+ children : expect . objectContaining ( {
263+ props : expect . objectContaining ( {
264+ children : 'Session contains 7'
265+ } )
266+ } )
241267 } )
242268 } )
243269 )
0 commit comments