diff --git a/crates/voelin-core/tests/session_fake.rs b/crates/voelin-core/tests/session_fake.rs index f433382..dd56422 100644 --- a/crates/voelin-core/tests/session_fake.rs +++ b/crates/voelin-core/tests/session_fake.rs @@ -358,6 +358,15 @@ async fn presence_follows_the_host_until_it_ends() { assert_eq!((name.as_str(), info.label().as_str()), ("Fake Host", "Fake 1.2")); // `files` is offered, `mailbox` is not, and no session has streams yet. assert!(caps.file_transfer && !caps.offline_messages && !caps.streams, "{caps:?}"); + // The server's details come with its first presence; its unique id is the + // host's name for it. + let details = h + .next(|e| match e { + Event::ServerDetails { details, .. } => Some(details), + _ => None, + }) + .await; + assert_eq!(details.uid.as_deref(), Some(SERVER_UID)); let shown = h .next(|e| match e { Event::Presence { presence, .. } if presence.clients.len() == 3 => Some(presence), @@ -373,6 +382,11 @@ async fn presence_follows_the_host_until_it_ends() { shown.clients.values().map(|c| (c.id, c.nickname.as_str(), c.channel)).collect(); let (me, alice, bob) = (ME as u16, ALICE as u16, BOB as u16); assert_eq!(clients, [(me, "tester", GAMES), (alice, "alice", GAMES), (bob, "bob", LOBBY)]); + // A Voelin user's unique id is shown as the base32 of its 32 bytes (here the + // user's id, 32 times: `user`). + assert_eq!(h.uid_of(ME), "aeaqcaibaeaqcaibaeaqcaibaeaqcaibaeaqcaibaeaqcaibaeaq"); + assert_eq!(h.uid_of(ALICE), "aibaeaqcaibaeaqcaibaeaqcaibaeaqcaibaeaqcaibaeaqcaiba"); + assert_eq!(h.uid_of(BOB), "ambqgaydambqgaydambqgaydambqgaydambqgaydambqgaydambq"); let state = h.state(|s| s.own_channel == Some(GAMES)).await; assert_eq!(state.voice, VoiceState::Connected); assert_eq!(state.own_client, Some(me));