diff --git a/crates/matrix-sdk-ui/tests/integration/timeline/pagination.rs b/crates/matrix-sdk-ui/tests/integration/timeline/pagination.rs index b73f86216..3a882c9a5 100644 --- a/crates/matrix-sdk-ui/tests/integration/timeline/pagination.rs +++ b/crates/matrix-sdk-ui/tests/integration/timeline/pagination.rs @@ -18,18 +18,17 @@ use assert_matches::assert_matches; use eyeball_im::VectorDiff; use futures_util::future::join; use matrix_sdk::config::SyncSettings; -use matrix_sdk_test::{ - async_test, test_json, JoinedRoomBuilder, StateTestEvent, SyncResponseBuilder, -}; +use matrix_sdk_test::{async_test, JoinedRoomBuilder, StateTestEvent, SyncResponseBuilder}; use matrix_sdk_ui::timeline::{ AnyOtherFullStateEventContent, BackPaginationStatus, PaginationOptions, RoomExt, TimelineItemContent, VirtualTimelineItem, }; +use once_cell::sync::Lazy; use ruma::{ events::{room::message::MessageType, FullStateEventContent}, room_id, }; -use serde_json::json; +use serde_json::{json, Value as JsonValue}; use stream_assert::{assert_next_eq, assert_next_matches}; use wiremock::{ matchers::{header, method, path_regex}, @@ -59,7 +58,7 @@ async fn back_pagination() { Mock::given(method("GET")) .and(path_regex(r"^/_matrix/client/r0/rooms/.*/messages$")) .and(header("authorization", "Bearer 1234")) - .respond_with(ResponseTemplate::new(200).set_body_json(&*test_json::ROOM_MESSAGES_BATCH_1)) + .respond_with(ResponseTemplate::new(200).set_body_json(&*ROOM_MESSAGES_BATCH_1)) .expect(1) .named("messages_batch_1") .mount(&server) @@ -224,3 +223,53 @@ async fn back_pagination_highlighted() { // `m.room.tombstone` should be highlighted by default. assert!(remote_event.is_highlighted()); } + +pub static ROOM_MESSAGES_BATCH_1: Lazy = Lazy::new(|| { + json!({ + "chunk": [ + { + "age": 1042, + "content": { + "body": "hello world", + "msgtype": "m.text" + }, + "event_id": "$1444812213350496Caaaf:example.com", + "origin_server_ts": 1444812213737i64, + "room_id": "!Xq3620DUiqCaoxq:example.com", + "sender": "@alice:example.com", + "type": "m.room.message" + }, + { + "age": 20123, + "content": { + "body": "the world is big", + "msgtype": "m.text" + }, + "event_id": "$1444812213350496Cbbbf:example.com", + "origin_server_ts": 1444812194656i64, + "room_id": "!Xq3620DUiqCaoxq:example.com", + "sender": "@bob:example.com", + "type": "m.room.message" + }, + { + "age": 50789, + "content": { + "name": "New room name" + }, + "event_id": "$1444812213350496Ccccf:example.com", + "origin_server_ts": 1444812163990i64, + "unsigned": { + "prev_content": { + "name": "Old room name", + }, + }, + "room_id": "!Xq3620DUiqCaoxq:example.com", + "sender": "@bob:example.com", + "state_key": "", + "type": "m.room.name" + } + ], + "end": "t47409-4357353_219380_26003_2269", + "start": "t392-516_47314_0_7_1_1_1_11444_1" + }) +}); diff --git a/testing/matrix-sdk-test/src/test_json/messages.rs b/testing/matrix-sdk-test/src/test_json/messages.rs deleted file mode 100644 index 2a9faa963..000000000 --- a/testing/matrix-sdk-test/src/test_json/messages.rs +++ /dev/null @@ -1,55 +0,0 @@ -//! Example responses from calls to `GET -//! /_matrix/client/v3/rooms/{roomId}/messages`. - -use once_cell::sync::Lazy; -use serde_json::{json, Value as JsonValue}; - -pub static ROOM_MESSAGES_BATCH_1: Lazy = Lazy::new(|| { - json!({ - "chunk": [ - { - "age": 1042, - "content": { - "body": "hello world", - "msgtype": "m.text" - }, - "event_id": "$1444812213350496Caaaf:example.com", - "origin_server_ts": 1444812213737i64, - "room_id": "!Xq3620DUiqCaoxq:example.com", - "sender": "@alice:example.com", - "type": "m.room.message" - }, - { - "age": 20123, - "content": { - "body": "the world is big", - "msgtype": "m.text" - }, - "event_id": "$1444812213350496Cbbbf:example.com", - "origin_server_ts": 1444812194656i64, - "room_id": "!Xq3620DUiqCaoxq:example.com", - "sender": "@bob:example.com", - "type": "m.room.message" - }, - { - "age": 50789, - "content": { - "name": "New room name" - }, - "event_id": "$1444812213350496Ccccf:example.com", - "origin_server_ts": 1444812163990i64, - "unsigned": { - "prev_content": { - "name": "Old room name", - }, - }, - "room_id": "!Xq3620DUiqCaoxq:example.com", - "sender": "@bob:example.com", - "state_key": "", - "type": "m.room.name" - } - ], - "end": "t47409-4357353_219380_26003_2269", - "start": "t392-516_47314_0_7_1_1_1_11444_1" - }) -}); diff --git a/testing/matrix-sdk-test/src/test_json/mod.rs b/testing/matrix-sdk-test/src/test_json/mod.rs index d031258aa..777b17f05 100644 --- a/testing/matrix-sdk-test/src/test_json/mod.rs +++ b/testing/matrix-sdk-test/src/test_json/mod.rs @@ -9,7 +9,6 @@ use serde_json::{json, Value as JsonValue}; pub mod api_responses; pub mod members; -pub mod messages; pub mod search_users; pub mod sync; pub mod sync_events; @@ -21,7 +20,6 @@ pub use api_responses::{ UNKNOWN_TOKEN_SOFT_LOGOUT, VERSIONS, WELL_KNOWN, WHOAMI, }; pub use members::MEMBERS; -pub use messages::ROOM_MESSAGES_BATCH_1; pub use sync::{ DEFAULT_SYNC_ROOM_ID, DEFAULT_SYNC_SUMMARY, INVITE_SYNC, LEAVE_SYNC, LEAVE_SYNC_EVENT, MORE_SYNC, MORE_SYNC_2, SYNC, VOIP_SYNC,