From 47ffe320f667a4fddcd4d3621de5d32aaa153841 Mon Sep 17 00:00:00 2001 From: Timo Date: Tue, 26 Nov 2024 17:14:29 +0100 Subject: [PATCH] review --- crates/matrix-sdk/src/test_utils/mocks.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/matrix-sdk/src/test_utils/mocks.rs b/crates/matrix-sdk/src/test_utils/mocks.rs index e80e71db520..84c5de8fde7 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. ///