Assert the unique ids and the server's uid in the presence test
presence_follows_the_host_until_it_ends showed the clients' names and channels but not what the engine keys contacts and private history by: the unique id of each client (the base32 of a Voelin user's 32 bytes) and the server's unique id in ServerDetails. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b92379d01b
commit
362e2b9da1
1 file changed
+14
@@ -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"));
|
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.
|
// `files` is offered, `mailbox` is not, and no session has streams yet.
|
||||||
assert!(caps.file_transfer && !caps.offline_messages && !caps.streams, "{caps:?}");
|
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
|
let shown = h
|
||||||
.next(|e| match e {
|
.next(|e| match e {
|
||||||
Event::Presence { presence, .. } if presence.clients.len() == 3 => Some(presence),
|
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();
|
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);
|
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)]);
|
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;
|
let state = h.state(|s| s.own_channel == Some(GAMES)).await;
|
||||||
assert_eq!(state.voice, VoiceState::Connected);
|
assert_eq!(state.voice, VoiceState::Connected);
|
||||||
assert_eq!(state.own_client, Some(me));
|
assert_eq!(state.own_client, Some(me));
|
||||||
|
|||||||
Reference in new issue
Block a user