mirror of
https://github.com/chatmail/core.git
synced 2026-05-25 01:36:31 +03:00
replace tokio sleep with SystemTime::shift
This commit is contained in:
@@ -79,6 +79,7 @@ mod test_chatlist_events {
|
|||||||
EventType,
|
EventType,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use crate::tools::SystemTime;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
|
||||||
async fn wait_for_chatlist_and_specific_item(context: &TestContext, chat_id: ChatId) {
|
async fn wait_for_chatlist_and_specific_item(context: &TestContext, chat_id: ChatId) {
|
||||||
@@ -352,7 +353,7 @@ mod test_chatlist_events {
|
|||||||
);
|
);
|
||||||
chat::set_muted(&alice, chat, mute_duration).await?;
|
chat::set_muted(&alice, chat, mute_duration).await?;
|
||||||
alice.evtracker.clear_events();
|
alice.evtracker.clear_events();
|
||||||
tokio::time::sleep(Duration::from_secs(3)).await;
|
SystemTime::shift(Duration::from_secs(3));
|
||||||
wait_for_chatlist_specific_item(&alice, chat).await;
|
wait_for_chatlist_specific_item(&alice, chat).await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -521,7 +522,7 @@ mod test_chatlist_events {
|
|||||||
let _ = chat::send_text_msg(&alice, chat, "Hello".to_owned()).await?;
|
let _ = chat::send_text_msg(&alice, chat, "Hello".to_owned()).await?;
|
||||||
|
|
||||||
alice.evtracker.clear_events();
|
alice.evtracker.clear_events();
|
||||||
tokio::time::sleep(Duration::from_secs(2)).await;
|
SystemTime::shift(Duration::from_secs(3));
|
||||||
wait_for_chatlist_and_specific_item(&alice, chat).await;
|
wait_for_chatlist_and_specific_item(&alice, chat).await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user