1
1
import { randomUUID } from 'crypto'
2
2
import * as React from 'react'
3
- import { Button , Text } from 'react-native'
3
+ import { Text , TouchableOpacity } from 'react-native'
4
4
import * as TestRenderer from 'react-test-renderer'
5
5
import { createSessionStoreManagerComponent , SessionStore } from '../../..'
6
6
@@ -15,12 +15,13 @@ test('displays the loading screen', async () => {
15
15
< SessionStoreManager
16
16
loading = { < Text > Loading</ Text > }
17
17
ready = { ( session , setSession ) => (
18
- < Button
19
- title = { `Session contains ${ session . value } ` }
18
+ < TouchableOpacity
20
19
onPress = { ( ) => {
21
20
setSession ( { value : session . value + 1 } )
22
21
} }
23
- />
22
+ >
23
+ < Text > { `Session contains ${ session . value } ` } </ Text >
24
+ </ TouchableOpacity >
24
25
) }
25
26
/>
26
27
)
@@ -52,12 +53,13 @@ test('shows the ready screen once given time to load', async () => {
52
53
< SessionStoreManager
53
54
loading = { < Text > Loading</ Text > }
54
55
ready = { ( session , setSession ) => (
55
- < Button
56
- title = { `Session contains ${ session . value } ` }
56
+ < TouchableOpacity
57
57
onPress = { ( ) => {
58
58
setSession ( { value : session . value + 1 } )
59
59
} }
60
- />
60
+ >
61
+ < Text > { `Session contains ${ session . value } ` } </ Text >
62
+ </ TouchableOpacity >
61
63
) }
62
64
/>
63
65
)
@@ -69,7 +71,11 @@ test('shows the ready screen once given time to load', async () => {
69
71
expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
70
72
expect . objectContaining ( {
71
73
props : expect . objectContaining ( {
72
- title : 'Session contains 5'
74
+ children : expect . objectContaining ( {
75
+ props : expect . objectContaining ( {
76
+ children : 'Session contains 5'
77
+ } )
78
+ } )
73
79
} )
74
80
} )
75
81
)
@@ -91,12 +97,13 @@ test('re-renders when the session is changed externally once', async () => {
91
97
< SessionStoreManager
92
98
loading = { < Text > Loading</ Text > }
93
99
ready = { ( session , setSession ) => (
94
- < Button
95
- title = { `Session contains ${ session . value } ` }
100
+ < TouchableOpacity
96
101
onPress = { ( ) => {
97
102
setSession ( { value : session . value + 1 } )
98
103
} }
99
- />
104
+ >
105
+ < Text > { `Session contains ${ session . value } ` } </ Text >
106
+ </ TouchableOpacity >
100
107
) }
101
108
/>
102
109
)
@@ -109,7 +116,11 @@ test('re-renders when the session is changed externally once', async () => {
109
116
expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
110
117
expect . objectContaining ( {
111
118
props : expect . objectContaining ( {
112
- title : 'Session contains 6'
119
+ children : expect . objectContaining ( {
120
+ props : expect . objectContaining ( {
121
+ children : 'Session contains 6'
122
+ } )
123
+ } )
113
124
} )
114
125
} )
115
126
)
@@ -131,12 +142,13 @@ test('re-renders when the session is changed externally twice', async () => {
131
142
< SessionStoreManager
132
143
loading = { < Text > Loading</ Text > }
133
144
ready = { ( session , setSession ) => (
134
- < Button
135
- title = { `Session contains ${ session . value } ` }
145
+ < TouchableOpacity
136
146
onPress = { ( ) => {
137
147
setSession ( { value : session . value + 1 } )
138
148
} }
139
- />
149
+ >
150
+ < Text > { `Session contains ${ session . value } ` } </ Text >
151
+ </ TouchableOpacity >
140
152
) }
141
153
/>
142
154
)
@@ -150,7 +162,11 @@ test('re-renders when the session is changed externally twice', async () => {
150
162
expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
151
163
expect . objectContaining ( {
152
164
props : expect . objectContaining ( {
153
- title : 'Session contains 7'
165
+ children : expect . objectContaining ( {
166
+ props : expect . objectContaining ( {
167
+ children : 'Session contains 7'
168
+ } )
169
+ } )
154
170
} )
155
171
} )
156
172
)
@@ -172,12 +188,13 @@ test('re-renders when the session is changed internally once', async () => {
172
188
< SessionStoreManager
173
189
loading = { < Text > Loading</ Text > }
174
190
ready = { ( session , setSession ) => (
175
- < Button
176
- title = { `Session contains ${ session . value } ` }
191
+ < TouchableOpacity
177
192
onPress = { ( ) => {
178
193
setSession ( { value : session . value + 1 } )
179
194
} }
180
- />
195
+ >
196
+ < Text > { `Session contains ${ session . value } ` } </ Text >
197
+ </ TouchableOpacity >
181
198
) }
182
199
/>
183
200
)
@@ -192,7 +209,11 @@ test('re-renders when the session is changed internally once', async () => {
192
209
expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
193
210
expect . objectContaining ( {
194
211
props : expect . objectContaining ( {
195
- title : 'Session contains 6'
212
+ children : expect . objectContaining ( {
213
+ props : expect . objectContaining ( {
214
+ children : 'Session contains 6'
215
+ } )
216
+ } )
196
217
} )
197
218
} )
198
219
)
@@ -214,12 +235,13 @@ test('re-renders when the session is changed internally twice', async () => {
214
235
< SessionStoreManager
215
236
loading = { < Text > Loading</ Text > }
216
237
ready = { ( session , setSession ) => (
217
- < Button
218
- title = { `Session contains ${ session . value } ` }
238
+ < TouchableOpacity
219
239
onPress = { ( ) => {
220
240
setSession ( { value : session . value + 1 } )
221
241
} }
222
- />
242
+ >
243
+ < Text > { `Session contains ${ session . value } ` } </ Text >
244
+ </ TouchableOpacity >
223
245
) }
224
246
/>
225
247
)
@@ -237,7 +259,11 @@ test('re-renders when the session is changed internally twice', async () => {
237
259
expect ( renderer . toTree ( ) ?. rendered ) . toEqual (
238
260
expect . objectContaining ( {
239
261
props : expect . objectContaining ( {
240
- title : 'Session contains 7'
262
+ children : expect . objectContaining ( {
263
+ props : expect . objectContaining ( {
264
+ children : 'Session contains 7'
265
+ } )
266
+ } )
241
267
} )
242
268
} )
243
269
)
0 commit comments