refactor(test): remove more unused test event variants

This commit is contained in:
Benjamin Bouvier
2026-02-12 15:02:12 +01:00
parent 2ab1d8a985
commit e299adbdeb
2 changed files with 2 additions and 15 deletions

View File

@@ -16,8 +16,6 @@ use ruma::{
};
use serde_json::{Value as JsonValue, from_value as from_json_value, json};
use super::test_json;
mod bulk;
mod invited_room;
mod joined_room;
@@ -30,7 +28,7 @@ pub use invited_room::InvitedRoomBuilder;
pub use joined_room::JoinedRoomBuilder;
pub use knocked_room::KnockedRoomBuilder;
pub use left_room::LeftRoomBuilder;
pub use test_event::{PresenceTestEvent, RoomAccountDataTestEvent, StrippedStateTestEvent};
pub use test_event::{PresenceTestEvent, 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`.
@@ -115,10 +113,7 @@ impl SyncResponseBuilder {
/// Add a presence event.
pub fn add_presence_event(&mut self, event: PresenceTestEvent) -> &mut Self {
let val = match event {
PresenceTestEvent::Presence => test_json::PRESENCE.to_owned(),
PresenceTestEvent::Custom(json) => json,
};
let PresenceTestEvent::Custom(val) = event;
self.presence.push(from_json_value(val).unwrap());
self

View File

@@ -8,16 +8,12 @@ use crate::test_json;
/// Test events that can be added to the stripped state.
pub enum StrippedStateTestEvent {
Member,
RoomName,
Custom(JsonValue),
}
impl From<StrippedStateTestEvent> for JsonValue {
fn from(val: StrippedStateTestEvent) -> Self {
match val {
StrippedStateTestEvent::Member => test_json::sync_events::MEMBER_STRIPPED.to_owned(),
StrippedStateTestEvent::RoomName => test_json::sync_events::NAME_STRIPPED.to_owned(),
StrippedStateTestEvent::Custom(json) => json,
}
}
@@ -32,7 +28,6 @@ impl From<StrippedStateTestEvent> for Raw<AnyStrippedStateEvent> {
/// Test events that can be added to the room account data.
pub enum RoomAccountDataTestEvent {
FullyRead,
Tags,
MarkedUnread,
Custom(JsonValue),
}
@@ -41,7 +36,6 @@ impl From<RoomAccountDataTestEvent> for JsonValue {
fn from(val: RoomAccountDataTestEvent) -> Self {
match val {
RoomAccountDataTestEvent::FullyRead => test_json::sync_events::FULLY_READ.to_owned(),
RoomAccountDataTestEvent::Tags => test_json::sync_events::TAG.to_owned(),
RoomAccountDataTestEvent::MarkedUnread => {
test_json::sync_events::MARKED_UNREAD.to_owned()
}
@@ -58,14 +52,12 @@ impl From<RoomAccountDataTestEvent> for Raw<AnyRoomAccountDataEvent> {
/// Test events that can be added to the presence events.
pub enum PresenceTestEvent {
Presence,
Custom(JsonValue),
}
impl From<PresenceTestEvent> for JsonValue {
fn from(val: PresenceTestEvent) -> Self {
match val {
PresenceTestEvent::Presence => test_json::sync_events::PRESENCE.to_owned(),
PresenceTestEvent::Custom(json) => json,
}
}