events: Add a test for edit deserialization without unstable-pre-spec

This commit is contained in:
Jonas Platte 2020-11-18 14:12:54 +01:00
parent 0f64a6ea39
commit 9a4206b1b2
No known key found for this signature in database
GPG Key ID: 7D261D771D915378

View File

@ -646,6 +646,28 @@ mod tests {
assert_eq!(to_json_value(&message_event_content).unwrap(), json_data);
}
#[test]
#[cfg(not(feature = "unstable-pre-spec"))]
fn edit_deserialization() {
let json_data = json!({
"body": "test",
"msgtype": "m.text",
"m.relates_to": {
"rel_type": "m.replace",
"event_id": event_id!("$1598361704261elfgc:localhost"),
}
});
assert_matches!(
from_json_value::<MessageEventContent>(json_data).unwrap(),
MessageEventContent::Text(TextMessageEventContent {
body,
formatted: None,
relates_to: Some(Relation::Custom(_)),
}) if body == "test"
);
}
#[test]
fn content_deserialization() {
let json_data = json!({