mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
Add send_recv() to test_utils.rs
link2xt approved orally
This commit is contained in:
@@ -106,9 +106,17 @@ impl TestContextManager {
|
|||||||
/// - Let the other TestContext receive it and accept the chat
|
/// - Let the other TestContext receive it and accept the chat
|
||||||
/// - Assert that the message arrived
|
/// - Assert that the message arrived
|
||||||
pub async fn send_recv_accept(&self, from: &TestContext, to: &TestContext, msg: &str) {
|
pub async fn send_recv_accept(&self, from: &TestContext, to: &TestContext, msg: &str) {
|
||||||
|
let received_msg = self.send_recv(from, to, msg).await;
|
||||||
|
received_msg.chat_id.accept(to).await.unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// - Let one TestContext send a message
|
||||||
|
/// - Let the other TestContext receive it
|
||||||
|
/// - Assert that the message arrived
|
||||||
|
pub async fn send_recv(&self, from: &TestContext, to: &TestContext, msg: &str) -> Message {
|
||||||
let received_msg = self.try_send_recv(from, to, msg).await;
|
let received_msg = self.try_send_recv(from, to, msg).await;
|
||||||
assert_eq!(received_msg.text.as_ref().unwrap(), msg);
|
assert_eq!(received_msg.text.as_ref().unwrap(), msg);
|
||||||
received_msg.chat_id.accept(to).await.unwrap();
|
received_msg
|
||||||
}
|
}
|
||||||
|
|
||||||
/// - Let one TestContext send a message
|
/// - Let one TestContext send a message
|
||||||
|
|||||||
Reference in New Issue
Block a user