From 72c6dc8e08a4a6c4e86c1b3146bd0bc275054e18 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Mon, 16 Feb 2026 15:00:03 +0100 Subject: [PATCH] refactor(test): get rid of `RoomAccountDataTestEvent` --- testing/matrix-sdk-test/src/lib.rs | 2 +- .../matrix-sdk-test/src/sync_builder/mod.rs | 2 -- .../src/sync_builder/test_event.rs | 26 ------------------- 3 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 testing/matrix-sdk-test/src/sync_builder/test_event.rs diff --git a/testing/matrix-sdk-test/src/lib.rs b/testing/matrix-sdk-test/src/lib.rs index a07b6559d..536404537 100644 --- a/testing/matrix-sdk-test/src/lib.rs +++ b/testing/matrix-sdk-test/src/lib.rs @@ -79,7 +79,7 @@ pub mod test_json; pub use self::sync_builder::{ InvitedRoomBuilder, JoinedRoomBuilder, KnockedRoomBuilder, LeftRoomBuilder, - RoomAccountDataTestEvent, SyncResponseBuilder, bulk_room_members, + SyncResponseBuilder, bulk_room_members, }; pub static ALICE: Lazy<&UserId> = Lazy::new(|| user_id!("@alice:server.name")); diff --git a/testing/matrix-sdk-test/src/sync_builder/mod.rs b/testing/matrix-sdk-test/src/sync_builder/mod.rs index 4dbcfca9d..f04bf16cc 100644 --- a/testing/matrix-sdk-test/src/sync_builder/mod.rs +++ b/testing/matrix-sdk-test/src/sync_builder/mod.rs @@ -21,14 +21,12 @@ mod invited_room; mod joined_room; mod knocked_room; mod left_room; -mod test_event; pub use bulk::bulk_room_members; pub use invited_room::InvitedRoomBuilder; pub use joined_room::JoinedRoomBuilder; pub use knocked_room::KnockedRoomBuilder; pub use left_room::LeftRoomBuilder; -pub use test_event::RoomAccountDataTestEvent; /// The `SyncResponseBuilder` struct can be used to easily generate valid sync /// responses for testing. These can be then fed into either `Client` or `Room`. diff --git a/testing/matrix-sdk-test/src/sync_builder/test_event.rs b/testing/matrix-sdk-test/src/sync_builder/test_event.rs deleted file mode 100644 index 4f4a3113f..000000000 --- a/testing/matrix-sdk-test/src/sync_builder/test_event.rs +++ /dev/null @@ -1,26 +0,0 @@ -use ruma::{event_id, events::AnyRoomAccountDataEvent, serde::Raw}; -use serde_json::Value as JsonValue; - -use crate::event_factory::EventFactory; - -/// Test events that can be added to the room account data. -pub enum RoomAccountDataTestEvent { - FullyRead, - MarkedUnread, - Custom(JsonValue), -} - -impl From for Raw { - fn from(val: RoomAccountDataTestEvent) -> Self { - let f = EventFactory::new(); - match val { - RoomAccountDataTestEvent::FullyRead => { - f.fully_read(event_id!("$someplace:example.org")).into() - } - RoomAccountDataTestEvent::MarkedUnread => f.marked_unread(true).into(), - RoomAccountDataTestEvent::Custom(json) => { - serde_json::from_value(json).expect("Custom JSON should be valid") - } - } - } -}