diff --git a/xmpp-parsers/src/mam.rs b/xmpp-parsers/src/mam.rs index 1f6bc5f9..d1a67a39 100644 --- a/xmpp-parsers/src/mam.rs +++ b/xmpp-parsers/src/mam.rs @@ -193,6 +193,7 @@ impl From for Element { #[cfg(test)] mod tests { use super::*; + use crate::data_forms::{DataFormType, Field, FieldType}; use std::str::FromStr; #[cfg(target_pointer_width = "32")] @@ -378,7 +379,7 @@ mod tests { } #[test] - fn test_serialise() { + fn test_serialise_empty() { let elem: Element = "".parse().unwrap(); let replace = Query { queryid: None, @@ -389,4 +390,47 @@ mod tests { let elem2 = replace.into(); assert_eq!(elem, elem2); } + + #[ignore] + #[test] + fn test_serialize_query_with() { + let elem: Element = r#" + + + + urn:xmpp:mam:2 + + + juliet@capulet.lit + + + + "# + .parse() + .unwrap(); + + let form = DataForm { + type_: DataFormType::Submit, + form_type: Some(String::from(ns::MAM)), + title: None, + instructions: None, + fields: vec![Field { + var: String::from("var"), + type_: FieldType::TextSingle, + label: None, + required: true, + options: vec![], + values: vec![String::from("juliet@capulet.lit")], + media: vec![], + }], + }; + let foo = Query { + queryid: None, + node: None, + set: None, + form: Some(form), + }; + let elem2 = foo.into(); + assert_eq!(elem, elem2); + } }