Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
toger5 committed Nov 26, 2024
1 parent 5d5bec4 commit 966bf1c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions crates/matrix-sdk/src/test_utils/mocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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!(
Expand Down Expand Up @@ -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.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/matrix-sdk/tests/integration/widget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 966bf1c

Please sign in to comment.