ruwuma/crates/ruma-events/tests/it/initial_state.rs
Kévin Commaille a53bd09b8a events: Make name required in RoomNameEventContent
The wording of the spec was confusing but it is indeed required
2023-09-18 15:05:26 +02:00

15 lines
384 B
Rust

use assert_matches2::assert_matches;
use ruma_events::AnyInitialStateEvent;
use serde_json::json;
#[test]
fn deserialize_initial_state_event() {
let ev = serde_json::from_value(json!({
"type": "m.room.name",
"content": { "name": "foo" }
}))
.unwrap();
assert_matches!(ev, AnyInitialStateEvent::RoomName(ev));
assert_eq!(ev.content.name, "foo");
}