From 5da57952865dd4a91c8adde52310b84e2fe56544 Mon Sep 17 00:00:00 2001 From: Paul Fariello Date: Thu, 5 Dec 2019 21:09:03 +0100 Subject: [PATCH] Add serialization test for carbons forwarded elemt --- xmpp-parsers/src/carbons.rs | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/xmpp-parsers/src/carbons.rs b/xmpp-parsers/src/carbons.rs index caf86353..07af9081 100644 --- a/xmpp-parsers/src/carbons.rs +++ b/xmpp-parsers/src/carbons.rs @@ -127,11 +127,39 @@ mod tests { #[test] fn test_serialize_received() { - assert!(false); + let reference: Element = "" + .parse() + .unwrap(); + + let elem: Element = "" + .parse() + .unwrap(); + let forwarded = Forwarded::try_from(elem).unwrap(); + + let received = Received { + forwarded: forwarded, + }; + + let serialized: Element = received.into(); + assert_eq!(serialized, reference); } #[test] fn test_serialize_sent() { - assert!(false); + let reference: Element = "" + .parse() + .unwrap(); + + let elem: Element = "" + .parse() + .unwrap(); + let forwarded = Forwarded::try_from(elem).unwrap(); + + let sent = Sent { + forwarded: forwarded, + }; + + let serialized: Element = sent.into(); + assert_eq!(serialized, reference); } }