@@ -189,14 +189,15 @@ describe("Store doesn't update *too many* times during navigation", () => {
189
189
test ( 'hover preload, then navigate, w/ async loaders' , async ( ) => {
190
190
const { select } = setup ( {
191
191
beforeLoad : ( ) => Promise . resolve ( { foo : 'bar' } ) ,
192
- loader : ( ) => Promise . resolve ( { hello : 'world' } ) ,
192
+ loader : ( ) => resolveAfter ( 100 , { hello : 'world' } ) ,
193
193
} )
194
194
195
195
const link = await waitFor ( ( ) =>
196
196
screen . getByRole ( 'link' , { name : 'Posts' } ) ,
197
197
)
198
198
const before = select . mock . calls . length
199
199
fireEvent . focus ( link )
200
+ await new Promise ( ( resolve ) => setTimeout ( resolve , 50 ) )
200
201
fireEvent . click ( link )
201
202
const title = await waitFor ( ( ) =>
202
203
screen . getByRole ( 'heading' , { name : / T i t l e $ / } ) ,
@@ -208,6 +209,6 @@ describe("Store doesn't update *too many* times during navigation", () => {
208
209
// This number should be as small as possible to minimize the amount of work
209
210
// that needs to be done during a navigation.
210
211
// Any change that increases this number should be investigated.
211
- expect ( updates ) . toBe ( 15 )
212
+ expect ( updates ) . toBe ( 14 )
212
213
} )
213
214
} )
0 commit comments