Make it clear that some functions are tests or test helpers only

This commit is contained in:
Benjamin Bouvier
2023-12-19 11:40:49 +01:00
parent 09e355a7bc
commit 73af3d9cfa
3 changed files with 18 additions and 9 deletions

View File

@@ -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(

View File

@@ -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**", "<b>My msg</b>", 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(

View File

@@ -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<SyncResponse> {
pub async fn process_sliding_sync_test_helper(
&self,
response: &v4::Response,
) -> Result<SyncResponse> {
let response = self.base_client().process_sliding_sync(response, &()).await?;
debug!("done processing on base_client");