diff --git a/crates/proto-xmpp/src/roster.rs b/crates/proto-xmpp/src/roster.rs index f7d0305..835cf94 100644 --- a/crates/proto-xmpp/src/roster.rs +++ b/crates/proto-xmpp/src/roster.rs @@ -38,3 +38,32 @@ impl ToXml for RosterQuery { events.push(Event::Empty(BytesStart::new(format!(r#"query xmlns="{}""#, XMLNS)))); } } + +#[cfg(test)] +mod tests { + use super::*; + use crate::bind::{Jid, Name, Resource, Server}; + use crate::client::{Iq, IqType}; + + #[test] + fn test_parse() { + let input = + r#""#; + + let result: Iq = parse(input).unwrap(); + assert_eq!( + result, + Iq { + from: Option::from(Jid { + name: Option::from(Name("juliet".into())), + server: Server("example.com".into()), + resource: Option::from(Resource("balcony".into())) + }), + id: "bv1bs71f".to_string(), + to: None, + r#type: IqType::Get, + body: RosterQuery, + } + ) + } +}