File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -272,15 +272,15 @@ class ObservableDeferredConnectRedisRuntime
272272}
273273
274274async function waitFor (
275- condition : ( ) => boolean ,
275+ condition : ( ) => boolean | Promise < boolean > ,
276276 timeoutMs = 200 ,
277277) : Promise < void > {
278278 const deadline = Date . now ( ) + timeoutMs ;
279279 while ( Date . now ( ) < deadline ) {
280- if ( condition ( ) ) return ;
280+ if ( await condition ( ) ) return ;
281281 await new Promise ( ( resolve ) => setTimeout ( resolve , 5 ) ) ;
282282 }
283- assert ( condition ( ) , "condition not met before timeout" ) ;
283+ assert ( await condition ( ) , "condition not met before timeout" ) ;
284284}
285285
286286describe ( "redis client" , ( ) => {
@@ -458,9 +458,11 @@ describe("redis client", () => {
458458 lastQuery : "Continue overhaul" ,
459459 } ) ;
460460
461- await new Promise ( ( resolve ) => setTimeout ( resolve , 10 ) ) ;
462-
463- assertEquals ( await redis . getHashAll ( "memory-cache:group-1:meta" ) , { } ) ;
461+ await waitFor ( async ( ) =>
462+ Object . keys ( await redis . getHashAll ( "memory-cache:group-1:meta" ) )
463+ . length ===
464+ 0
465+ ) ;
464466 await redis . close ( ) ;
465467 } ) ;
466468
You can’t perform that action at this time.
0 commit comments