@@ -63,7 +63,7 @@ use tokio::{
6363 task:: JoinHandle ,
6464 time:: { sleep, timeout} ,
6565} ;
66- use tracing:: { debug, trace , warn} ;
66+ use tracing:: { debug, warn} ;
6767
6868use crate :: helpers:: TestClientBuilder ;
6969
@@ -193,7 +193,7 @@ async fn test_toggling_reaction() -> Result<()> {
193193 sleep ( Duration :: from_secs ( 1 ) ) . await ;
194194
195195 assert_let ! ( Some ( timeline_updates) = stream. next( ) . await ) ;
196- assert_eq ! ( timeline_updates. len( ) , 2 ) ;
196+ assert_eq ! ( timeline_updates. len( ) , 3 ) ;
197197
198198 // Local echo is added.
199199 {
@@ -204,9 +204,11 @@ async fn test_toggling_reaction() -> Result<()> {
204204 assert_matches ! ( reaction. status, ReactionStatus :: LocalToRemote ( ..) ) ;
205205 }
206206
207- // Remote echo is added.
208- {
209- let event = assert_event_is_updated ! ( timeline_updates[ 1 ] , event_id, message_position) ;
207+ // Remote echo is added twice: one from the Send Queue because the event is sent
208+ // and inserted in the Event Cache and one from the Event Cache via the sync.
209+ // The difference is it gets a read receipt, that's why we get a second update.
210+ for i in 1 ..3 {
211+ let event = assert_event_is_updated ! ( timeline_updates[ i] , event_id, message_position) ;
210212
211213 let reactions = event. content ( ) . reactions ( ) . cloned ( ) . unwrap_or_default ( ) ;
212214 let reactions = reactions. get ( & reaction_key) . unwrap ( ) ;
@@ -219,9 +221,10 @@ async fn test_toggling_reaction() -> Result<()> {
219221 // Note: this can actually be equal because if the timestamp from
220222 // server is not available, it might be created with a local call to `now()`
221223 assert ! ( reaction. timestamp <= MilliSecondsSinceUnixEpoch :: now( ) ) ;
222- assert ! ( stream. next( ) . now_or_never( ) . is_none( ) ) ;
223224 }
224225
226+ assert_pending ! ( stream) ;
227+
225228 // Redact the reaction.
226229 timeline
227230 . toggle_reaction ( & item_id, & reaction_key)
0 commit comments