mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
new clear_events
This commit is contained in:
@@ -4,7 +4,7 @@ use std::collections::{BTreeMap, HashMap};
|
|||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::atomic::{AtomicBool, AtomicI64, AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
|
|||||||
@@ -785,6 +785,17 @@ impl TestContext {
|
|||||||
|
|
||||||
chat_id
|
chat_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Clears event queue.
|
||||||
|
/// Works by emitting a `TestCheckpointEvent` and consuming all events until.
|
||||||
|
/// times out after 10 seconds.
|
||||||
|
pub async fn clear_events(&self) {
|
||||||
|
let event_id = self.emit_test_checkpoint_event().await;
|
||||||
|
self.evtracker.get_matching(|ev| match ev {
|
||||||
|
EventType::TestCheckpointEvent { id } => event_id == *id,
|
||||||
|
_ => false
|
||||||
|
}).await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Deref for TestContext {
|
impl Deref for TestContext {
|
||||||
|
|||||||
Reference in New Issue
Block a user