diff --git a/src/tests/presence.rs b/src/tests/presence.rs index 427ecd0..1182e0b 100644 --- a/src/tests/presence.rs +++ b/src/tests/presence.rs @@ -511,8 +511,8 @@ async fn update_joined() { new_room( ROOM1_BARE.clone(), vec![ - (SUGAKO_FULL1.clone(), SUGAKO_NICK), - (PETER_FULL1.clone(), PETER_NICK), + (SUGAKO_NICK, vec![SUGAKO_FULL1.clone()]), + (PETER_NICK, vec![PETER_FULL1.clone()]), ], ) .await, diff --git a/src/tests/presence_msn.rs b/src/tests/presence_msn.rs index 7a75389..72276b5 100644 --- a/src/tests/presence_msn.rs +++ b/src/tests/presence_msn.rs @@ -150,9 +150,11 @@ async fn leave() { new_room( ROOM1_BARE.clone(), vec![ - (LOUISE_FULL1.clone(), LOUISE_NICK), - (SUGAKO_FULL1.clone(), SUGAKO_NICK), - (LOUISE_FULL2.clone(), LOUISE_NICK), + ( + LOUISE_NICK, + vec![LOUISE_FULL1.clone(), LOUISE_FULL2.clone()], + ), + (SUGAKO_NICK, vec![SUGAKO_FULL1.clone()]), ], ) .await, diff --git a/src/tests/templates.rs b/src/tests/templates.rs index 44c95ab..2a2eb19 100644 --- a/src/tests/templates.rs +++ b/src/tests/templates.rs @@ -106,27 +106,29 @@ pub fn two_participant_room(roomjid: BareJid) -> Room { // TODO: Fix this. Add yet another layer of struct that doesn't send stanzas so we don't need to // duplicate Room code in here without all the safeguards? -pub async fn new_room>(roomjid: BareJid, sessions: Vec<(FullJid, N)>) -> Room { +pub async fn new_room>(roomjid: BareJid, occupants: Vec<(N, Vec)>) -> Room { let mut room = Room::new(roomjid.clone()); - for (session, nick) in sessions { + for (nick, occupant) in occupants { let nick: Nick = nick.into(); - let participant = roomjid.clone().with_resource(nick.clone()); - let presence = PresenceFull::try_from( - Presence::new(PresenceType::None) - .with_to(participant) - .with_from(session), - ) - .unwrap(); - match room.occupants.get_mut(&nick) { - Some(occupant) => occupant.add_session(presence).unwrap(), - None => { - let _ = room - .occupants - .insert(nick.clone(), Occupant::new(presence).unwrap()); - } - }; + for session in occupant { + let presence = PresenceFull::try_from( + Presence::new(PresenceType::None) + .with_to(participant.clone()) + .with_from(session), + ) + .unwrap(); + + match room.occupants.get_mut(&nick) { + Some(occupant) => occupant.add_session(presence).unwrap(), + None => { + let _ = room + .occupants + .insert(nick.clone(), Occupant::new(presence).unwrap()); + } + }; + } } room }