matrix-sdk: Move the EventBuilder into a separate crate so it can be reused.
This commit is contained in:
parent
d32172f74e
commit
207fac2b49
7 changed files with 26 additions and 11 deletions
|
@ -2,6 +2,7 @@
|
|||
members = [
|
||||
"matrix_sdk",
|
||||
"matrix_sdk_base",
|
||||
"matrix_sdk_test",
|
||||
"matrix_sdk_crypto",
|
||||
"matrix_sdk_common",
|
||||
]
|
||||
|
|
|
@ -45,6 +45,7 @@ default-features = false
|
|||
features = ["sync", "time", "fs"]
|
||||
|
||||
[dev-dependencies]
|
||||
matrix-sdk-test = { version = "0.1.0", path = "../matrix_sdk_test" }
|
||||
tokio = { version = "0.2.20", features = ["rt-threaded", "macros"] }
|
||||
ruma-identifiers = { version = "0.16.1", features = ["rand"] }
|
||||
serde_json = "1.0.52"
|
||||
|
|
|
@ -37,9 +37,6 @@ mod models;
|
|||
mod session;
|
||||
mod state;
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod test_builder;
|
||||
|
||||
pub use base_client::{Client, RoomState, RoomStateType};
|
||||
pub use event_emitter::EventEmitter;
|
||||
#[cfg(feature = "encryption")]
|
||||
|
|
|
@ -524,8 +524,8 @@ mod test {
|
|||
use crate::api::r0::sync::sync_events::Response as SyncResponse;
|
||||
use crate::events::room::member::MembershipState;
|
||||
use crate::identifiers::UserId;
|
||||
use crate::test_builder::EventBuilder;
|
||||
use crate::{Client, Session};
|
||||
use matrix_sdk_test::EventBuilder;
|
||||
|
||||
use http::Response;
|
||||
|
||||
|
|
|
@ -199,10 +199,11 @@ impl RoomMember {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use matrix_sdk_test::EventBuilder;
|
||||
|
||||
use crate::events::collections::all::RoomEvent;
|
||||
use crate::events::room::member::MembershipState;
|
||||
use crate::identifiers::{RoomId, UserId};
|
||||
use crate::test_builder::EventBuilder;
|
||||
use crate::{Client, Session};
|
||||
|
||||
use crate::js_int::Int;
|
||||
|
|
16
matrix_sdk_test/Cargo.toml
Normal file
16
matrix_sdk_test/Cargo.toml
Normal file
|
@ -0,0 +1,16 @@
|
|||
[package]
|
||||
authors = ["Damir Jelić <poljar@termina.org.uk"]
|
||||
description = "Helpers to write tests for the Matrix SDK"
|
||||
edition = "2018"
|
||||
homepage = "https://github.com/matrix-org/matrix-rust-sdk"
|
||||
keywords = ["matrix", "chat", "messaging", "ruma"]
|
||||
license = "Apache-2.0"
|
||||
name = "matrix-sdk-test"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/matrix-org/matrix-rust-sdk"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
serde_json = "1.0.52"
|
||||
http = "*"
|
||||
matrix-sdk-common = { version = "0.1.0", path = "../matrix_sdk_common" }
|
|
@ -1,11 +1,12 @@
|
|||
#![cfg(test)]
|
||||
|
||||
use std::convert::TryFrom;
|
||||
use std::fs;
|
||||
use std::panic;
|
||||
use std::path::Path;
|
||||
|
||||
use crate::api::r0::sync::sync_events::Response as SyncResponse;
|
||||
use crate::events::{
|
||||
use http::Response;
|
||||
|
||||
use matrix_sdk_common::api::r0::sync::sync_events::Response as SyncResponse;
|
||||
use matrix_sdk_common::events::{
|
||||
collections::{
|
||||
all::{RoomEvent, StateEvent},
|
||||
only::Event,
|
||||
|
@ -13,8 +14,6 @@ use crate::events::{
|
|||
presence::PresenceEvent,
|
||||
EventJson, TryFromRaw,
|
||||
};
|
||||
use http::Response;
|
||||
use std::convert::TryFrom;
|
||||
|
||||
/// Easily create events to stream into either a Client or a `Room` for testing.
|
||||
#[derive(Default)]
|
Loading…
Reference in a new issue