test: remove unused helpers

This commit is contained in:
Benjamin Bouvier
2025-03-24 16:33:08 +01:00
parent 693c8df8d0
commit 404dd3949f
4 changed files with 8 additions and 42 deletions

View File

@@ -120,9 +120,9 @@ mod sync_builder;
pub mod test_json;
pub use self::sync_builder::{
bulk_room_members, EphemeralTestEvent, GlobalAccountDataTestEvent, InvitedRoomBuilder,
JoinedRoomBuilder, KnockedRoomBuilder, LeftRoomBuilder, PresenceTestEvent,
RoomAccountDataTestEvent, StateTestEvent, StrippedStateTestEvent, SyncResponseBuilder,
bulk_room_members, GlobalAccountDataTestEvent, InvitedRoomBuilder, JoinedRoomBuilder,
KnockedRoomBuilder, LeftRoomBuilder, PresenceTestEvent, RoomAccountDataTestEvent,
StateTestEvent, StrippedStateTestEvent, SyncResponseBuilder,
};
pub static ALICE: Lazy<&UserId> = Lazy::new(|| user_id!("@alice:server.name"));

View File

@@ -2,14 +2,14 @@ use ruma::{
api::client::sync::sync_events::v3::JoinedRoom,
events::{
receipt::ReceiptEventContent, typing::TypingEventContent, AnyRoomAccountDataEvent,
AnySyncEphemeralRoomEvent, AnySyncStateEvent, AnySyncTimelineEvent,
AnySyncStateEvent, AnySyncTimelineEvent,
},
serde::Raw,
OwnedRoomId, RoomId,
};
use serde_json::{from_value as from_json_value, Value as JsonValue};
use super::{EphemeralTestEvent, RoomAccountDataTestEvent, StateTestEvent};
use super::{RoomAccountDataTestEvent, StateTestEvent};
use crate::{event_factory::EventBuilder, DEFAULT_TEST_ROOM_ID};
pub struct JoinedRoomBuilder {
@@ -88,21 +88,6 @@ impl JoinedRoomBuilder {
self
}
/// Add an ephemeral event.
pub fn add_ephemeral_event(mut self, event: EphemeralTestEvent) -> Self {
self.inner.ephemeral.events.push(event.into_raw_event());
self
}
/// Add ephemeral events in bulk.
pub fn add_ephemeral_bulk<I>(mut self, events: I) -> Self
where
I: IntoIterator<Item = Raw<AnySyncEphemeralRoomEvent>>,
{
self.inner.ephemeral.events.extend(events);
self
}
/// Add a single read receipt to the joined room's ephemeral events.
pub fn add_receipt(mut self, f: EventBuilder<ReceiptEventContent>) -> Self {
self.inner.ephemeral.events.push(f.into_raw());

View File

@@ -29,8 +29,8 @@ pub use joined_room::JoinedRoomBuilder;
pub use knocked_room::KnockedRoomBuilder;
pub use left_room::LeftRoomBuilder;
pub use test_event::{
EphemeralTestEvent, GlobalAccountDataTestEvent, PresenceTestEvent, RoomAccountDataTestEvent,
StateTestEvent, StrippedStateTestEvent,
GlobalAccountDataTestEvent, PresenceTestEvent, RoomAccountDataTestEvent, StateTestEvent,
StrippedStateTestEvent,
};
/// The `SyncResponseBuilder` struct can be used to easily generate valid sync

View File

@@ -1,7 +1,7 @@
use ruma::{
events::{
presence::PresenceEvent, AnyGlobalAccountDataEvent, AnyRoomAccountDataEvent,
AnyStrippedStateEvent, AnySyncEphemeralRoomEvent, AnySyncStateEvent,
AnyStrippedStateEvent, AnySyncStateEvent,
},
serde::Raw,
};
@@ -112,25 +112,6 @@ impl RoomAccountDataTestEvent {
}
}
/// Test events that can be added to the ephemeral events.
pub enum EphemeralTestEvent {
Custom(JsonValue),
}
impl EphemeralTestEvent {
/// Get the JSON representation of this test event.
pub fn into_json_value(self) -> JsonValue {
match self {
Self::Custom(json) => json,
}
}
/// Get the typed JSON representation of this test event.
pub fn into_raw_event(self) -> Raw<AnySyncEphemeralRoomEvent> {
from_json_value(self.into_json_value()).unwrap()
}
}
/// Test events that can be added to the presence events.
pub enum PresenceTestEvent {
Presence,