From c1923434951b0d428904b19edccdd7309131f919 Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Mon, 14 Aug 2023 12:54:45 +0200 Subject: [PATCH] test(ui): Improve the `remote_echo_full_trip` test. This patch improves the `remote_echo_full_trip` `Timeline` test to ensure that until the event reaches the `Sent` state, it is indeed a local echo. --- crates/matrix-sdk-ui/src/timeline/tests/echo.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/matrix-sdk-ui/src/timeline/tests/echo.rs b/crates/matrix-sdk-ui/src/timeline/tests/echo.rs index 2b1f166b8..3b315d929 100644 --- a/crates/matrix-sdk-ui/src/timeline/tests/echo.rs +++ b/crates/matrix-sdk-ui/src/timeline/tests/echo.rs @@ -45,8 +45,9 @@ async fn remote_echo_full_trip() { // Scenario 1: The local event has not been sent yet to the server. let id = { let item = assert_next_matches!(stream, VectorDiff::PushBack { value } => value); - let event = item.as_event().unwrap(); - assert_matches!(event.send_state(), Some(EventSendState::NotSentYet)); + let event_item = item.as_event().unwrap(); + assert!(event_item.is_local_echo()); + assert_matches!(event_item.send_state(), Some(EventSendState::NotSentYet)); item.unique_id() }; @@ -63,8 +64,9 @@ async fn remote_echo_full_trip() { .await; let item = assert_next_matches!(stream, VectorDiff::Set { value, index: 1 } => value); - let event = item.as_event().unwrap(); - assert_matches!(event.send_state(), Some(EventSendState::SendingFailed { .. })); + let event_item = item.as_event().unwrap(); + assert!(event_item.is_local_echo()); + assert_matches!(event_item.send_state(), Some(EventSendState::SendingFailed { .. })); assert_eq!(item.unique_id(), id); } @@ -82,6 +84,7 @@ async fn remote_echo_full_trip() { let item = assert_next_matches!(stream, VectorDiff::Set { value, index: 1 } => value); let event_item = item.as_event().unwrap(); + assert!(event_item.is_local_echo()); assert_matches!(event_item.send_state(), Some(EventSendState::Sent { .. })); assert_eq!(item.unique_id(), id);