cargo fmt
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
1f4e6f6451
commit
8322f5e11f
1 changed files with 57 additions and 51 deletions
|
@ -75,35 +75,38 @@ async fn test_join_presence_empty_room() {
|
|||
.into()]),
|
||||
);
|
||||
|
||||
component.expect_message(move |mut out| {
|
||||
let roomjid = COMPONENT_JID.clone().with_node("room");
|
||||
component.expect_message(
|
||||
move |mut out| {
|
||||
let roomjid = COMPONENT_JID.clone().with_node("room");
|
||||
|
||||
let mut subjects = BTreeMap::new();
|
||||
subjects.insert(String::from("en"), MessageSubject::from_str("").unwrap());
|
||||
let expected: Element = Message {
|
||||
// Set by the first participant
|
||||
from: Some(Jid::Full(to)),
|
||||
to: Some(Jid::Full(from)),
|
||||
id: None,
|
||||
type_: MessageType::Groupchat,
|
||||
bodies: BTreeMap::new(),
|
||||
subjects,
|
||||
thread: None,
|
||||
payloads: Vec::new(),
|
||||
}
|
||||
.into();
|
||||
let mut subjects = BTreeMap::new();
|
||||
subjects.insert(String::from("en"), MessageSubject::from_str("").unwrap());
|
||||
let expected: Element = Message {
|
||||
// Set by the first participant
|
||||
from: Some(Jid::Full(to)),
|
||||
to: Some(Jid::Full(from)),
|
||||
id: None,
|
||||
type_: MessageType::Groupchat,
|
||||
bodies: BTreeMap::new(),
|
||||
subjects,
|
||||
thread: None,
|
||||
payloads: Vec::new(),
|
||||
}
|
||||
.into();
|
||||
|
||||
assert_eq!(out.payloads.len(), 1);
|
||||
let delay = Delay::try_from(out.payloads[0].clone()).unwrap();
|
||||
// Ensure delay is issued from the room JID. Ignore stamp as it'll always vary.
|
||||
assert_eq!(delay.from, Some(Jid::Bare(roomjid)));
|
||||
assert_eq!(out.payloads.len(), 1);
|
||||
let delay = Delay::try_from(out.payloads[0].clone()).unwrap();
|
||||
// Ensure delay is issued from the room JID. Ignore stamp as it'll always vary.
|
||||
assert_eq!(delay.from, Some(Jid::Bare(roomjid)));
|
||||
|
||||
out.payloads = vec![];
|
||||
assert_eq!(
|
||||
String::from(&expected),
|
||||
String::from(&Into::<Element>::into(out))
|
||||
);
|
||||
}, "Room subject to participant1");
|
||||
out.payloads = vec![];
|
||||
assert_eq!(
|
||||
String::from(&expected),
|
||||
String::from(&Into::<Element>::into(out))
|
||||
);
|
||||
},
|
||||
"Room subject to participant1",
|
||||
);
|
||||
|
||||
handle_stanza(&mut component, &mut rooms).await.unwrap();
|
||||
|
||||
|
@ -232,33 +235,36 @@ async fn test_join_presence_existing_room() {
|
|||
.into()]),
|
||||
);
|
||||
|
||||
component.expect_message(|el| {
|
||||
let mut subjects = BTreeMap::new();
|
||||
subjects.insert(String::from("en"), MessageSubject::from_str("").unwrap());
|
||||
let expected: Element = Message {
|
||||
// Set by the first participant
|
||||
from: Some(Jid::Full(participant1)),
|
||||
to: Some(Jid::Full(realjid2)),
|
||||
id: None,
|
||||
type_: MessageType::Groupchat,
|
||||
bodies: BTreeMap::new(),
|
||||
subjects,
|
||||
thread: None,
|
||||
payloads: Vec::new(),
|
||||
}
|
||||
.into();
|
||||
component.expect_message(
|
||||
|el| {
|
||||
let mut subjects = BTreeMap::new();
|
||||
subjects.insert(String::from("en"), MessageSubject::from_str("").unwrap());
|
||||
let expected: Element = Message {
|
||||
// Set by the first participant
|
||||
from: Some(Jid::Full(participant1)),
|
||||
to: Some(Jid::Full(realjid2)),
|
||||
id: None,
|
||||
type_: MessageType::Groupchat,
|
||||
bodies: BTreeMap::new(),
|
||||
subjects,
|
||||
thread: None,
|
||||
payloads: Vec::new(),
|
||||
}
|
||||
.into();
|
||||
|
||||
let mut out = Message::try_from(el).unwrap();
|
||||
// Check that <delay/> is present. Don't check content as it's checked in a test earlier
|
||||
assert_eq!(out.payloads.len(), 1);
|
||||
let _delay = Delay::try_from(out.payloads[0].clone()).unwrap();
|
||||
let mut out = Message::try_from(el).unwrap();
|
||||
// Check that <delay/> is present. Don't check content as it's checked in a test earlier
|
||||
assert_eq!(out.payloads.len(), 1);
|
||||
let _delay = Delay::try_from(out.payloads[0].clone()).unwrap();
|
||||
|
||||
out.payloads = vec![];
|
||||
assert_eq!(
|
||||
String::from(&expected),
|
||||
String::from(&Into::<Element>::into(out))
|
||||
);
|
||||
}, "Subject for participant2");
|
||||
out.payloads = vec![];
|
||||
assert_eq!(
|
||||
String::from(&expected),
|
||||
String::from(&Into::<Element>::into(out))
|
||||
);
|
||||
},
|
||||
"Subject for participant2",
|
||||
);
|
||||
|
||||
handle_stanza(&mut component, &mut rooms).await.unwrap();
|
||||
|
||||
|
|
Loading…
Reference in a new issue