From 73af3d9cfa534dabf8ea0e86c2ab7198b757cf74 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Tue, 19 Dec 2023 11:40:49 +0100 Subject: [PATCH] Make it clear that some functions are tests or test helpers only --- crates/matrix-sdk-ui/src/timeline/event_item/mod.rs | 10 ++++++---- .../matrix-sdk-ui/src/timeline/sliding_sync_ext.rs | 12 ++++++++---- crates/matrix-sdk/src/sliding_sync/client.rs | 5 ++++- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/crates/matrix-sdk-ui/src/timeline/event_item/mod.rs b/crates/matrix-sdk-ui/src/timeline/event_item/mod.rs index 1d5fa797a..054c33feb 100644 --- a/crates/matrix-sdk-ui/src/timeline/event_item/mod.rs +++ b/crates/matrix-sdk-ui/src/timeline/event_item/mod.rs @@ -560,7 +560,8 @@ mod tests { } #[async_test] - async fn latest_message_event_can_be_wrapped_as_a_timeline_item_with_sender_from_the_storage() { + async fn test_latest_message_event_can_be_wrapped_as_a_timeline_item_with_sender_from_the_storage( + ) { // Given a sync event that is suitable to be used as a latest_event, and a room // with a member event for the sender @@ -574,7 +575,7 @@ mod tests { // And the room is stored in the client so it can be extracted when needed let response = response_with_room(room_id, room).await; - client.process_sliding_sync(&response).await.unwrap(); + client.process_sliding_sync_test_helper(&response).await.unwrap(); // When we construct a timeline event from it let timeline_item = @@ -595,7 +596,8 @@ mod tests { } #[async_test] - async fn latest_message_event_can_be_wrapped_as_a_timeline_item_with_sender_from_the_cache() { + async fn test_latest_message_event_can_be_wrapped_as_a_timeline_item_with_sender_from_the_cache( + ) { // Given a sync event that is suitable to be used as a latest_event, a room, and // a member event for the sender (which isn't part of the room yet). @@ -617,7 +619,7 @@ mod tests { // And the room is stored in the client so it can be extracted when needed let response = response_with_room(room_id, room).await; - client.process_sliding_sync(&response).await.unwrap(); + client.process_sliding_sync_test_helper(&response).await.unwrap(); // When we construct a timeline event from it let timeline_item = EventTimelineItem::from_latest_event( diff --git a/crates/matrix-sdk-ui/src/timeline/sliding_sync_ext.rs b/crates/matrix-sdk-ui/src/timeline/sliding_sync_ext.rs index 7d1bc5995..296182248 100644 --- a/crates/matrix-sdk-ui/src/timeline/sliding_sync_ext.rs +++ b/crates/matrix-sdk-ui/src/timeline/sliding_sync_ext.rs @@ -87,13 +87,13 @@ mod tests { } #[async_test] - async fn latest_message_event_is_wrapped_as_a_timeline_item() { + async fn test_latest_message_event_is_wrapped_as_a_timeline_item() { // Given a room exists, and an event came in through a sync let room_id = room_id!("!r:x.uk"); let user_id = user_id!("@s:o.uk"); let client = logged_in_client(None).await; let event = message_event(room_id, user_id, "**My msg**", "My msg", 122343); - process_event_via_sync(room_id, event, &client).await; + process_event_via_sync_test_helper(room_id, event, &client).await; // When we ask for the latest event in the room let room = SlidingSyncRoom::new( @@ -118,11 +118,15 @@ mod tests { } } - async fn process_event_via_sync(room_id: &RoomId, event: SyncTimelineEvent, client: &Client) { + async fn process_event_via_sync_test_helper( + room_id: &RoomId, + event: SyncTimelineEvent, + client: &Client, + ) { let mut room = v4::SlidingSyncRoom::new(); room.timeline.push(event.event); let response = response_with_room(room_id, room).await; - client.process_sliding_sync(&response).await.unwrap(); + client.process_sliding_sync_test_helper(&response).await.unwrap(); } fn message_event( diff --git a/crates/matrix-sdk/src/sliding_sync/client.rs b/crates/matrix-sdk/src/sliding_sync/client.rs index 274903479..b01c4033c 100644 --- a/crates/matrix-sdk/src/sliding_sync/client.rs +++ b/crates/matrix-sdk/src/sliding_sync/client.rs @@ -22,7 +22,10 @@ impl Client { /// If you need to handle encryption too, use the internal /// `SlidingSyncResponseProcessor` instead. #[instrument(skip(self, response))] - pub async fn process_sliding_sync(&self, response: &v4::Response) -> Result { + pub async fn process_sliding_sync_test_helper( + &self, + response: &v4::Response, + ) -> Result { let response = self.base_client().process_sliding_sync(response, &()).await?; debug!("done processing on base_client");