Skip to content

Commit 6276b91

Browse files
committed
Fix test_recreate_contact_list_on_missing_messages
1 parent 9336f5b commit 6276b91

File tree

2 files changed

+10
-23
lines changed

2 files changed

+10
-23
lines changed

src/receive_imf/tests.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4221,7 +4221,7 @@ async fn test_dont_recreate_contacts_on_add_remove() -> Result<()> {
42214221
}
42224222

42234223
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
4224-
async fn test_recreate_contact_list_on_missing_messages() -> Result<()> {
4224+
async fn test_delayed_removal_is_ignored() -> Result<()> {
42254225
let alice = TestContext::new_alice().await;
42264226
let bob = TestContext::new_bob().await;
42274227
let chat_id = create_group_chat(&alice, ProtectionStatus::Unprotected, "Group").await?;
@@ -4241,38 +4241,33 @@ async fn test_recreate_contact_list_on_missing_messages() -> Result<()> {
42414241
let bob_chat_id = bob.recv_msg(&alice.pop_sent_msg().await).await.chat_id;
42424242
bob_chat_id.accept(&bob).await?;
42434243

4244-
// bob removes a member
4244+
// Bob removes Fiona.
42454245
let bob_contact_fiona = Contact::create(&bob, "fiona", "fiona@example.net").await?;
42464246
remove_contact_from_chat(&bob, bob_chat_id, bob_contact_fiona).await?;
42474247
let remove_msg = bob.pop_sent_msg().await;
42484248

4249-
// bob adds new members
4249+
// Bob adds new members "blue" and "orange", but first addition message is lost.
42504250
let bob_blue = Contact::create(&bob, "blue", "blue@example.net").await?;
42514251
add_contact_to_chat(&bob, bob_chat_id, bob_blue).await?;
42524252
bob.pop_sent_msg().await;
42534253
let bob_orange = Contact::create(&bob, "orange", "orange@example.net").await?;
42544254
add_contact_to_chat(&bob, bob_chat_id, bob_orange).await?;
42554255
let add_msg = bob.pop_sent_msg().await;
42564256

4257-
// alice only receives the second member addition
4257+
// Alice only receives the second member addition,
4258+
// but this results in addition of both members
4259+
// and removal of Fiona.
42584260
alice.recv_msg(&add_msg).await;
4259-
4260-
// since we missed messages, a new contact list should be build
42614261
assert_eq!(get_chat_contacts(&alice, chat_id).await?.len(), 4);
42624262

4263-
// re-add fiona
4263+
// Alice re-adds Fiona.
42644264
add_contact_to_chat(&alice, chat_id, alice_fiona).await?;
4265+
assert_eq!(get_chat_contacts(&alice, chat_id).await?.len(), 5);
42654266

4266-
// delayed removal of fiona shouldn't remove her
4267-
alice.recv_msg_trash(&remove_msg).await;
4267+
// Delayed removal of Fiona by Bob shouldn't remove her.
4268+
alice.recv_msg(&remove_msg).await;
42684269
assert_eq!(get_chat_contacts(&alice, chat_id).await?.len(), 5);
42694270

4270-
alice
4271-
.golden_test_chat(
4272-
chat_id,
4273-
"receive_imf_recreate_contact_list_on_missing_messages",
4274-
)
4275-
.await;
42764271
Ok(())
42774272
}
42784273

test-data/golden/receive_imf_recreate_contact_list_on_missing_messages

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)