@@ -319,6 +319,7 @@ export const Generic = () => {
319319 await act ( ( ) => dispatchConnectionChangedEvent ( chatClient , false ) ) ;
320320 // await waiter();
321321 await act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
322+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
322323
323324 await waitFor ( async ( ) => {
324325 expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ;
@@ -331,8 +332,10 @@ export const Generic = () => {
331332
332333 renderComponent ( ) ;
333334
335+ act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
336+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
337+
334338 await waitFor ( async ( ) => {
335- act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
336339 expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ;
337340 await expectAllChannelsWithStateToBeInDB ( screen . queryAllByLabelText ) ;
338341 } ) ;
@@ -345,8 +348,11 @@ export const Generic = () => {
345348
346349 renderComponent ( ) ;
347350
348- await waitFor ( ( ) => {
351+ await waitFor ( async ( ) => {
349352 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
353+ await act (
354+ async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ,
355+ ) ;
350356 expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ;
351357 expect ( screen . getByTestId ( emptyChannel . cid ) ) . toBeTruthy ( ) ;
352358 expect ( chatClient . hydrateActiveChannels ) . toHaveBeenCalled ( ) ;
@@ -359,6 +365,7 @@ export const Generic = () => {
359365
360366 renderComponent ( ) ;
361367 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
368+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
362369 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
363370 const newMessage = generateMessage ( {
364371 cid : channels [ 0 ] . channel . cid ,
@@ -378,8 +385,11 @@ export const Generic = () => {
378385 useMockedApis ( chatClient , [ queryChannelsApi ( channels ) ] ) ;
379386
380387 renderComponent ( ) ;
381- await waitFor ( ( ) => {
388+ await waitFor ( async ( ) => {
382389 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
390+ await act (
391+ async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ,
392+ ) ;
383393 expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ;
384394 } ) ;
385395
@@ -402,6 +412,7 @@ export const Generic = () => {
402412
403413 renderComponent ( ) ;
404414 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
415+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
405416 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
406417
407418 const updatedMessage = { ...channels [ 0 ] . messages [ 0 ] } ;
@@ -423,6 +434,7 @@ export const Generic = () => {
423434
424435 renderComponent ( ) ;
425436 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
437+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
426438 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
427439 const removedChannel = channels [ getRandomInt ( 0 , channels . length - 1 ) ] . channel ;
428440 act ( ( ) => dispatchNotificationRemovedFromChannel ( chatClient , removedChannel ) ) ;
@@ -449,6 +461,7 @@ export const Generic = () => {
449461
450462 renderComponent ( ) ;
451463 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
464+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
452465 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
453466 const removedChannel = channels [ getRandomInt ( 0 , channels . length - 1 ) ] . channel ;
454467 act ( ( ) => dispatchChannelDeletedEvent ( chatClient , removedChannel ) ) ;
@@ -475,6 +488,7 @@ export const Generic = () => {
475488
476489 renderComponent ( ) ;
477490 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
491+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
478492 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
479493 const hiddenChannel = channels [ getRandomInt ( 0 , channels . length - 1 ) ] . channel ;
480494 act ( ( ) => dispatchChannelHiddenEvent ( chatClient , hiddenChannel ) ) ;
@@ -504,6 +518,7 @@ export const Generic = () => {
504518
505519 renderComponent ( ) ;
506520 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
521+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
507522 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
508523
509524 const newChannel = createChannel ( ) ;
@@ -534,6 +549,7 @@ export const Generic = () => {
534549
535550 renderComponent ( ) ;
536551 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
552+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
537553 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
538554
539555 const channelToTruncate = channels [ getRandomInt ( 0 , channels . length - 1 ) ] . channel ;
@@ -557,6 +573,7 @@ export const Generic = () => {
557573 useMockedApis ( chatClient , [ queryChannelsApi ( channels ) ] ) ;
558574 renderComponent ( ) ;
559575 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
576+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
560577 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
561578
562579 const targetChannel = channels [ getRandomInt ( 0 , channels . length - 1 ) ] ;
@@ -602,6 +619,7 @@ export const Generic = () => {
602619
603620 renderComponent ( ) ;
604621 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
622+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
605623 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
606624
607625 const targetChannel = channels [ getRandomInt ( 0 , channels . length - 1 ) ] ;
@@ -655,6 +673,7 @@ export const Generic = () => {
655673
656674 renderComponent ( ) ;
657675 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
676+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
658677 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
659678
660679 const targetChannel = channels [ getRandomInt ( 0 , channels . length - 1 ) ] ;
@@ -692,6 +711,7 @@ export const Generic = () => {
692711 renderComponent ( ) ;
693712
694713 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
714+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
695715 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
696716 const targetChannel = channels [ getRandomInt ( 0 , channels . length - 1 ) ] ;
697717
@@ -719,6 +739,7 @@ export const Generic = () => {
719739
720740 renderComponent ( ) ;
721741 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
742+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
722743 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
723744
724745 const targetChannel = channels [ getRandomInt ( 0 , channels . length - 1 ) ] ;
@@ -746,6 +767,7 @@ export const Generic = () => {
746767
747768 renderComponent ( ) ;
748769 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
770+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
749771 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
750772
751773 const targetChannel = channels [ getRandomInt ( 0 , channels . length - 1 ) ] ;
@@ -772,6 +794,7 @@ export const Generic = () => {
772794
773795 renderComponent ( ) ;
774796 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
797+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
775798 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
776799
777800 const targetChannel = channels [ getRandomInt ( 0 , channels . length - 1 ) ] ;
@@ -797,6 +820,7 @@ export const Generic = () => {
797820
798821 renderComponent ( ) ;
799822 act ( ( ) => dispatchConnectionChangedEvent ( chatClient ) ) ;
823+ await act ( async ( ) => await chatClient . offlineDb . syncManager . invokeSyncStatusListeners ( true ) ) ;
800824 await waitFor ( ( ) => expect ( screen . getByTestId ( 'channel-list' ) ) . toBeTruthy ( ) ) ;
801825 const targetChannel = channels [ getRandomInt ( 0 , channels . length - 1 ) ] ;
802826 const targetMember = targetChannel . members [ getRandomInt ( 0 , targetChannel . members . length - 1 ) ] ;
0 commit comments