diff --git a/crates/matrix-sdk/src/test_utils/mocks.rs b/crates/matrix-sdk/src/test_utils/mocks.rs index 2cc77022ace..4bb43f89e68 100644 --- a/crates/matrix-sdk/src/test_utils/mocks.rs +++ b/crates/matrix-sdk/src/test_utils/mocks.rs @@ -874,8 +874,6 @@ impl<'a> MockEndpoint<'a, RoomSendEndpoint> { /// Ensures that the send endpoint request uses a specific event type. /// - /// Note: works with *any* room. - /// /// # Examples /// /// see also [`MatrixMockServer::mock_room_send`] for more context. @@ -907,7 +905,6 @@ impl<'a> MockEndpoint<'a, RoomSendEndpoint> { /// // The `m.room.reaction` event type should not be mocked by the server. /// assert!(responseNotMocked.is_err()); /// - /// /// let response = room.send_raw("m.room.message", json!({ "body": "Hello world" })).await?; /// // The `m.room.message` event type should be mocked by the server. /// assert_eq!( @@ -977,10 +974,11 @@ impl<'a> MockEndpoint<'a, RoomSendStateEndpoint> { fn generate_path_regex(endpoint: &RoomSendStateEndpoint) -> String { format!( r"^/_matrix/client/v3/rooms/.*/state/{}/{}", - endpoint.event_type.as_ref().map(|t| t.to_string()).unwrap_or(".*".to_owned()), - endpoint.state_key.as_ref().map(|k| k.to_string()).unwrap_or(".*".to_owned()) + endpoint.event_type.as_ref().map(|t| t.to_string()).unwrap_or_else(|| ".*".to_owned()), + endpoint.state_key.as_ref().map(|k| k.to_string()).unwrap_or_else(|| ".*".to_owned()) ) } + /// Ensures that the body of the request is a superset of the provided /// `body` parameter. /// diff --git a/crates/matrix-sdk/tests/integration/widget.rs b/crates/matrix-sdk/tests/integration/widget.rs index e49ddc2d25f..8829a0ce81c 100644 --- a/crates/matrix-sdk/tests/integration/widget.rs +++ b/crates/matrix-sdk/tests/integration/widget.rs @@ -485,7 +485,7 @@ async fn test_send_room_message() { mock_server .mock_room_send() - .for_type("m.room.message".into()) + .for_type("m.room.message".into()).error500() .ok(event_id!("$foobar")) .mock_once() .mount()