From 84ae27744ab7d62826feaae736b8be091a28cb58 Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 20 Aug 2022 14:12:22 +0000 Subject: [PATCH] test_utils: add EventTracker.conusme_events() --- src/test_utils.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/test_utils.rs b/src/test_utils.rs index 305643f0f..3e95b81f2 100644 --- a/src/test_utils.rs +++ b/src/test_utils.rs @@ -856,6 +856,11 @@ impl EventTracker { }) .await } + + /// Consumes all pending events. + pub async fn consume_events(&self) { + while self.try_recv().is_ok() {} + } } /// Gets a specific message from a chat and asserts that the chat has a specific length.