refactor(test): get rid of RoomAccountDataTestEvent

This commit is contained in:
Benjamin Bouvier
2026-02-16 15:00:03 +01:00
parent 961edaf4b9
commit 72c6dc8e08
3 changed files with 1 additions and 29 deletions
+1 -1
View File
@@ -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"));
@@ -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`.
@@ -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<RoomAccountDataTestEvent> for Raw<AnyRoomAccountDataEvent> {
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")
}
}
}
}