diff --git a/xmpp-parsers/src/mam.rs b/xmpp-parsers/src/mam.rs index a8cea9c..dcfa239 100644 --- a/xmpp-parsers/src/mam.rs +++ b/xmpp-parsers/src/mam.rs @@ -403,13 +403,13 @@ mod tests { let form = DataForm::try_from(elem).unwrap(); - let foo = Query { + let query = Query { queryid: None, node: None, set: None, form: Some(form), }; - let serialized: Element = foo.into(); + let serialized: Element = query.into(); assert_eq!(serialized, reference); } diff --git a/xmpp-parsers/src/pubsub/pubsub.rs b/xmpp-parsers/src/pubsub/pubsub.rs index c62ed94..371dfc9 100644 --- a/xmpp-parsers/src/pubsub/pubsub.rs +++ b/xmpp-parsers/src/pubsub/pubsub.rs @@ -519,6 +519,8 @@ impl From for Element { mod tests { use super::*; use crate::data_forms::{DataForm, DataFormType, Field, FieldType}; + use jid::FullJid; + use std::str::FromStr; #[test] fn create() { @@ -690,23 +692,44 @@ mod tests { assert_eq!(subscribe_options2.required, true); } - #[test] - fn test_serialize_configure() { - assert!(false); - } - #[test] fn test_serialize_options() { - assert!(false); + let reference: Element = "" + .parse() + .unwrap(); + + let elem: Element = "" + .parse() + .unwrap(); + + let form = DataForm::try_from(elem).unwrap(); + + let options = Options { + jid: Jid::Full(FullJid::from_str("juliet@capulet.lit/balcony").unwrap()), + node: None, + subid: None, + form: Some(form), + }; + let serialized: Element = options.into(); + assert_eq!(serialized, reference); } #[test] fn test_serialize_publish_options() { - assert!(false); - } + let reference: Element = "" + .parse() + .unwrap(); - #[test] - fn test_serialize_subscriptions() { - assert!(false); + let elem: Element = "" + .parse() + .unwrap(); + + let form = DataForm::try_from(elem).unwrap(); + + let options = PublishOptions { + form: Some(form), + }; + let serialized: Element = options.into(); + assert_eq!(serialized, reference); } }