From c07bb0ec3982d5a1405fde49c8ff136970bd977a Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Thu, 15 Jun 2023 09:55:57 +0200 Subject: [PATCH] test(ui): Test that `RoomList` receives `State` updates even if the same. `RoomList::state` provides a `Subscriber` to the `State`. This patch modifies the way the state is tested, to ensure that there is always an update broadcasted even if the state is the same (e.g. if the state moves from `CarryOn` to `CarryOn`). --- crates/matrix-sdk-ui/tests/integration/room_list.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/matrix-sdk-ui/tests/integration/room_list.rs b/crates/matrix-sdk-ui/tests/integration/room_list.rs index 57099d905..b610e1871 100644 --- a/crates/matrix-sdk-ui/tests/integration/room_list.rs +++ b/crates/matrix-sdk-ui/tests/integration/room_list.rs @@ -83,7 +83,9 @@ macro_rules! sync_then_assert_request_and_fake_response { $( use State::*; - assert_matches!($room_list.state().get(), $pre_state, "pre state"); + let mut state = $room_list.state(); + + assert_matches!(state.get(), $pre_state, "pre state"); )? let next = $room_list_sync_stream.next().await; @@ -107,7 +109,7 @@ macro_rules! sync_then_assert_request_and_fake_response { } } - $( assert_matches!($room_list.state().get(), $post_state, "post state"); )? + $( assert_matches!(state.next().now_or_never(), Some(Some($post_state)), "post state"); )? next }