diff --git a/src/chat.rs b/src/chat.rs index bc797a76e..db8a955d7 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -4096,6 +4096,8 @@ mod tests { let alice_bob_contact_id = Contact::create(&alice, "Bob", "bob@example.net").await?; let alice_fiona_contact_id = Contact::create(&alice, "Fiona", "fiona@example.net").await?; + let alice_claire_contact_id = + Contact::create(&alice, "Claire", "claire@example.net").await?; // Create and promote a group. let alice_chat_id = @@ -4110,6 +4112,10 @@ mod tests { let bob_chat_id = bob_received_msg.get_chat_id(); bob_chat_id.accept(&bob).await?; + // Alice adds Claire to the chat. + add_contact_to_chat(&alice, alice_chat_id, alice_claire_contact_id).await?; + let alice_sent_add_msg = alice.pop_sent_msg().await; + // Alice removes Bob from the chat. remove_contact_from_chat(&alice, alice_chat_id, alice_bob_contact_id).await?; let alice_sent_remove_msg = alice.pop_sent_msg().await; @@ -4117,10 +4123,19 @@ mod tests { // Bob leaves the chat. remove_contact_from_chat(&bob, bob_chat_id, ContactId::SELF).await?; + // Bob receives a msg about Alice adding Claire to the group. + let bob_received_add_msg = bob.recv_msg(&alice_sent_add_msg).await; + + // Test that add message is rewritten. + assert_eq!( + bob_received_add_msg.get_text(), + "Member claire@example.net added by alice@example.org." + ); + // Bob receives a msg about Alice removing him from the group. let bob_received_remove_msg = bob.recv_msg(&alice_sent_remove_msg).await; - // Test that the message is rewritten. + // Test that remove message is rewritten. assert_eq!( bob_received_remove_msg.get_text(), "Member Me (bob@example.net) removed by alice@example.org."