From 6a6ceb68756432d3154aeb875a2215d5dd00bd1e Mon Sep 17 00:00:00 2001 From: Hocuri Date: Tue, 18 Apr 2023 16:08:19 +0200 Subject: [PATCH] Add send_recv() to test_utils.rs link2xt approved orally --- src/test_utils.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/test_utils.rs b/src/test_utils.rs index 003b3578c..4dc780371 100644 --- a/src/test_utils.rs +++ b/src/test_utils.rs @@ -106,9 +106,17 @@ impl TestContextManager { /// - Let the other TestContext receive it and accept the chat /// - Assert that the message arrived 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; 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