Skip to content

Commit

Permalink
test(ui): Test that RoomList receives State updates even if the s…
Browse files Browse the repository at this point in the history
…ame.

`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`).
  • Loading branch information
Hywan committed Jun 15, 2023
1 parent ddffa00 commit c07bb0e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/matrix-sdk-ui/tests/integration/room_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
}
Expand Down

0 comments on commit c07bb0e

Please sign in to comment.