From 9b7e74092633a8d7a70c4144f3d9bf86109f84c9 Mon Sep 17 00:00:00 2001 From: Hocuri Date: Mon, 6 Jan 2025 14:50:40 +0100 Subject: [PATCH] Fix almost all test failures. One of the failures is real, though. --- src/chat.rs | 4 ++-- src/chatlist.rs | 2 +- src/contact.rs | 11 ++++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index 83b8be9c1..99769fbcf 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -4677,7 +4677,7 @@ mod tests { { "id": 10, "type": 100, - "name": "~bob", + "name": "bob", "archived": false, "param": "", "gossiped_timestamp": 0, @@ -4975,7 +4975,7 @@ mod tests { // This is the name that will be sent outside. assert_eq!(alice_bob_contact.get_authname(), "Bob"); - assert_eq!(alice_bob_contact.get_display_name(), "~robert"); + assert_eq!(alice_bob_contact.get_display_name(), "robert"); } // Create and promote a group. diff --git a/src/chatlist.rs b/src/chatlist.rs index af541999c..b29337e55 100644 --- a/src/chatlist.rs +++ b/src/chatlist.rs @@ -727,7 +727,7 @@ mod tests { let test_id = Contact::create(&t, "Bob Nickname", "bob@example.org").await?; assert_eq!(contact_id, test_id); let chat = Chat::load_from_db(&t, chat_id).await?; - assert_eq!(chat.get_name(), "~Bob Nickname"); + assert_eq!(chat.get_name(), "Bob Nickname"); let chats = Chatlist::try_load(&t, 0, Some("bob@example.org"), None).await?; assert_eq!(chats.len(), 0); // email-addresses are searchable in contacts, not in chats let chats = Chatlist::try_load(&t, 0, Some("Bob Nickname"), None).await?; diff --git a/src/contact.rs b/src/contact.rs index e655754fb..4152569e6 100644 --- a/src/contact.rs +++ b/src/contact.rs @@ -2110,6 +2110,7 @@ mod tests { #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_add_or_lookup() { // add some contacts, this also tests add_address_book() + // TODO it's unsure whether we should put a ~ in front of these. let t = TestContext::new().await; let book = concat!( " Name one \n one@eins.org \n", @@ -2138,7 +2139,7 @@ mod tests { assert_eq!(contact.get_authname(), "bla foo"); assert_eq!(contact.get_display_name(), "~Name one"); assert_eq!(contact.get_addr(), "one@eins.org"); - assert_eq!(contact.get_name_n_addr(), "Name one (one@eins.org)"); + assert_eq!(contact.get_name_n_addr(), "~Name one (one@eins.org)"); // modify first added contact let (contact_id_test, sth_modified) = Contact::add_or_lookup( @@ -2185,7 +2186,7 @@ mod tests { assert_eq!(contact_id, contact_id_test); assert_eq!(sth_modified, Modifier::Modified); let contact = Contact::get_by_id(&t, contact_id).await.unwrap(); - assert_eq!(contact.get_name_n_addr(), "m. serious (three@drei.sam)"); + assert_eq!(contact.get_name_n_addr(), "~m. serious (three@drei.sam)"); assert!(!contact.is_blocked()); // manually edit name of third contact (does not changed authorized name) @@ -2217,9 +2218,9 @@ mod tests { assert_eq!(sth_modified, Modifier::None); let contact = Contact::get_by_id(&t, contact_id).await.unwrap(); assert_eq!(contact.get_name(), "Wonderland, Alice"); - assert_eq!(contact.get_display_name(), "Wonderland, Alice"); + assert_eq!(contact.get_display_name(), "~Wonderland, Alice"); assert_eq!(contact.get_addr(), "alice@w.de"); - assert_eq!(contact.get_name_n_addr(), "Wonderland, Alice (alice@w.de)"); + assert_eq!(contact.get_name_n_addr(), "~Wonderland, Alice (alice@w.de)"); // check SELF let contact = Contact::get_by_id(&t, ContactId::SELF).await.unwrap(); @@ -2304,7 +2305,7 @@ mod tests { ) .await?; let chat_id = t.get_last_msg().await.get_chat_id(); - assert_eq!(Chat::load_from_db(&t, chat_id).await?.name, "Foo Flobby"); + assert_eq!(Chat::load_from_db(&t, chat_id).await?.name, "~Foo Flobby"); let chatlist = Chatlist::try_load(&t, 0, Some("Flobbyfoo"), None).await?; assert_eq!(chatlist.len(), 0); let chatlist = Chatlist::try_load(&t, 0, Some("Foo Flobby"), None).await?;