From 8010b5a1e5838c3440ff608c0756b27a498a026d Mon Sep 17 00:00:00 2001 From: Paul Fariello Date: Thu, 5 Dec 2019 21:57:20 +0100 Subject: [PATCH] Add serialization test for muc item element --- xmpp-parsers/src/muc/user.rs | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/xmpp-parsers/src/muc/user.rs b/xmpp-parsers/src/muc/user.rs index 35cd1267..d457b5fc 100644 --- a/xmpp-parsers/src/muc/user.rs +++ b/xmpp-parsers/src/muc/user.rs @@ -690,6 +690,36 @@ mod tests { #[test] fn test_serialize_item() { - assert!(false); + let reference: Element = "foobar" + .parse() + .unwrap(); + + let elem: Element = "" + .parse() + .unwrap(); + let actor = Actor::try_from(elem).unwrap(); + + let elem: Element = "" + .parse() + .unwrap(); + let continue_ = Continue::try_from(elem).unwrap(); + + let elem: Element = "foobar" + .parse() + .unwrap(); + let reason = Reason::try_from(elem).unwrap(); + + let item = Item { + affiliation: Affiliation::Member, + role: Role::Moderator, + jid: None, + nick: None, + actor: Some(actor), + reason: Some(reason), + continue_: Some(continue_), + }; + + let serialized: Element = item.into(); + assert_eq!(serialized, reference); } }