From 99ae790446260056f79142a6449cf29e11324ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sat, 1 Oct 2022 16:30:40 +0200 Subject: [PATCH] events: Remove redundant tests There are similar tests in the relations module --- .../ruma-common/tests/events/room_message.rs | 96 ------------------- 1 file changed, 96 deletions(-) diff --git a/crates/ruma-common/tests/events/room_message.rs b/crates/ruma-common/tests/events/room_message.rs index 71a43d50..1cbe66d8 100644 --- a/crates/ruma-common/tests/events/room_message.rs +++ b/crates/ruma-common/tests/events/room_message.rs @@ -1,13 +1,7 @@ use std::borrow::Cow; use assert_matches::assert_matches; -#[cfg(not(feature = "unstable-msc1767"))] -use assign::assign; use js_int::uint; -#[cfg(not(feature = "unstable-msc1767"))] -use ruma_common::events::room::message::InReplyTo; -#[cfg(any(feature = "unstable-msc2676", not(feature = "unstable-msc1767")))] -use ruma_common::events::room::message::Relation; use ruma_common::{ event_id, events::{ @@ -308,96 +302,6 @@ fn markdown_content_serialization() { ); } -#[test] -#[cfg(not(feature = "unstable-msc1767"))] -fn relates_to_content_serialization() { - let message_event_content = - assign!(RoomMessageEventContent::text_plain("> <@test:example.com> test\n\ntest reply"), { - relates_to: Some(Relation::Reply { - in_reply_to: InReplyTo::new( - event_id!("$15827405538098VGFWH:example.com").to_owned(), - ), - }), - }); - - let json_data = json!({ - "body": "> <@test:example.com> test\n\ntest reply", - "msgtype": "m.text", - "m.relates_to": { - "m.in_reply_to": { - "event_id": "$15827405538098VGFWH:example.com" - } - } - }); - - assert_eq!(to_json_value(&message_event_content).unwrap(), json_data); -} - -#[test] -#[cfg(not(feature = "unstable-msc2676"))] -fn edit_deserialization_061() { - let json_data = json!({ - "body": "s/foo/bar", - "msgtype": "m.text", - "m.relates_to": { - "rel_type": "m.replace", - "event_id": "$1598361704261elfgc:localhost", - }, - "m.new_content": { - "body": "bar", - }, - }); - - let content = from_json_value::(json_data).unwrap(); - assert!(content.relates_to.is_some()); - - let text = assert_matches!( - content.msgtype, - MessageType::Text(text) => text - ); - assert_eq!(text.body, "s/foo/bar"); - assert_matches!(text.formatted, None); -} - -#[test] -#[cfg(feature = "unstable-msc2676")] -fn edit_deserialization_future() { - let json_data = json!({ - "body": "s/foo/bar", - "msgtype": "m.text", - "m.relates_to": { - "rel_type": "m.replace", - "event_id": "$1598361704261elfgc:localhost", - }, - "m.new_content": { - "body": "bar", - "msgtype": "m.text", - }, - }); - - let content = from_json_value::(json_data).unwrap(); - - let text = assert_matches!( - content.msgtype, - MessageType::Text(text) => text - ); - assert_eq!(text.body, "s/foo/bar"); - assert_matches!(text.formatted, None); - - let replacement = assert_matches!( - content.relates_to, - Some(Relation::Replacement(replacement)) => replacement - ); - assert_eq!(replacement.event_id, "$1598361704261elfgc:localhost"); - - let new_text = assert_matches!( - replacement.new_content.msgtype, - MessageType::Text(new_text) => new_text - ); - assert_eq!(new_text.body, "bar"); - assert_matches!(new_text.formatted, None); -} - #[test] fn verification_request_deserialization() { let user_id = user_id!("@example2:localhost");