Skip to content

Commit 15b7340

Browse files
committed
Use time shift in test_modify_chat_disordered instead of sleep
1 parent 8d60afe commit 15b7340

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/chat.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5243,7 +5243,7 @@ mod tests {
52435243
let _n = TimeShiftFalsePositiveNote;
52445244

52455245
// Alice creates a group with Bob, Claire and Daisy and then removes Claire and Daisy
5246-
// (sleep() is needed as otherwise smeared time from Alice looks to Bob like messages from the future which are all set to "now" then)
5246+
// (time shift is needed as otherwise smeared time from Alice looks to Bob like messages from the future which are all set to "now" then)
52475247
let alice = TestContext::new_alice().await;
52485248

52495249
let bob_id = Contact::create(&alice, "", "[email protected]").await?;
@@ -5258,17 +5258,17 @@ mod tests {
52585258

52595259
add_contact_to_chat(&alice, alice_chat_id, claire_id).await?;
52605260
let add2 = alice.pop_sent_msg().await;
5261-
tokio::time::sleep(std::time::Duration::from_millis(1100)).await;
5261+
SystemTime::shift(Duration::from_millis(1100));
52625262

52635263
add_contact_to_chat(&alice, alice_chat_id, daisy_id).await?;
52645264
let add3 = alice.pop_sent_msg().await;
5265-
tokio::time::sleep(std::time::Duration::from_millis(1100)).await;
5265+
SystemTime::shift(Duration::from_millis(1100));
52665266

52675267
assert_eq!(get_chat_contacts(&alice, alice_chat_id).await?.len(), 4);
52685268

52695269
remove_contact_from_chat(&alice, alice_chat_id, claire_id).await?;
52705270
let remove1 = alice.pop_sent_msg().await;
5271-
tokio::time::sleep(std::time::Duration::from_millis(1100)).await;
5271+
SystemTime::shift(Duration::from_millis(1100));
52725272

52735273
remove_contact_from_chat(&alice, alice_chat_id, daisy_id).await?;
52745274
let remove2 = alice.pop_sent_msg().await;

0 commit comments

Comments
 (0)