diff --git a/crates/matrix-sdk-base/src/client.rs b/crates/matrix-sdk-base/src/client.rs index a5ade6682..e4eeb8ded 100644 --- a/crates/matrix-sdk-base/src/client.rs +++ b/crates/matrix-sdk-base/src/client.rs @@ -1391,7 +1391,7 @@ mod tests { use crate::{store::StateStoreExt, DisplayName, Room, RoomState, SessionMeta, StateChanges}; #[async_test] - async fn invite_after_leaving() { + async fn test_invite_after_leaving() { let user_id = user_id!("@alice:example.org"); let room_id = room_id!("!test:example.org"); @@ -1435,7 +1435,7 @@ mod tests { } #[async_test] - async fn invite_displayname_integration_test() { + async fn test_invite_displayname() { let user_id = user_id!("@alice:example.org"); let room_id = room_id!("!ithpyNKDtmhneaTQja:example.org"); @@ -1529,7 +1529,7 @@ mod tests { let user_id = user_id!("@u:u.to"); let room_id = room_id!("!r:u.to"); let client = logged_in_client(user_id).await; - let room = process_room_join(&client, room_id, "$1", user_id).await; + let room = process_room_join_test_helper(&client, room_id, "$1", user_id).await; // Sanity: it has no latest_encrypted_events or latest_event assert!(room.latest_encrypted_events().is_empty()); @@ -1563,7 +1563,7 @@ mod tests { } #[cfg(feature = "e2e-encryption")] - async fn process_room_join( + async fn process_room_join_test_helper( client: &BaseClient, room_id: &RoomId, event_id: &str, @@ -1585,13 +1585,14 @@ mod tests { }), )) .build_sync_response(); + client.receive_sync_response(response).await.unwrap(); client.get_room(room_id).expect("Just-created room not found!") } #[async_test] - async fn deserialization_failure_test() { + async fn test_deserialization_failure() { let user_id = user_id!("@alice:example.org"); let room_id = room_id!("!ithpyNKDtmhneaTQja:example.org"); diff --git a/crates/matrix-sdk-base/src/sync.rs b/crates/matrix-sdk-base/src/sync.rs index 28fddb3ee..ab9e7f636 100644 --- a/crates/matrix-sdk-base/src/sync.rs +++ b/crates/matrix-sdk-base/src/sync.rs @@ -36,7 +36,7 @@ use crate::{ deserialized_responses::{AmbiguityChange, RawAnySyncOrStrippedTimelineEvent}, }; -/// Internal representation of a `/sync` response. +/// Generalized representation of a `/sync` response. /// /// This type is intended to be applicable regardless of the endpoint used for /// syncing. diff --git a/crates/matrix-sdk/src/sync.rs b/crates/matrix-sdk/src/sync.rs index 85f1f6bb1..b5457207a 100644 --- a/crates/matrix-sdk/src/sync.rs +++ b/crates/matrix-sdk/src/sync.rs @@ -124,6 +124,8 @@ impl fmt::Debug for RoomUpdate { /// Internal functionality related to getting events from the server /// (`sync_events` endpoint) impl Client { + /// Receive a sync response, compute extra information out of it and store + /// the interesting bits in the database, then call all the handlers. pub(crate) async fn process_sync( &self, response: sync_events::v3::Response, @@ -135,6 +137,7 @@ impl Client { self.encryption().backups().maybe_trigger_backup(); self.handle_sync_response(&response).await?; + Ok(response) }