mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 13:56:30 +03:00
fix formatting and most of the test
This commit is contained in:
@@ -2852,7 +2852,11 @@ pub unsafe extern "C" fn dc_chat_get_mailinglist_addr(chat: *mut dc_chat_t) -> *
|
||||
return "".strdup();
|
||||
}
|
||||
let ffi_chat = &*chat;
|
||||
ffi_chat.chat.get_mailinglist_addr().unwrap_or_default().strdup()
|
||||
ffi_chat
|
||||
.chat
|
||||
.get_mailinglist_addr()
|
||||
.unwrap_or_default()
|
||||
.strdup()
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
@@ -81,7 +81,7 @@ impl FullChat {
|
||||
false
|
||||
};
|
||||
|
||||
let mailing_list_address = chat.get_mailinglist_addr().map(|s|s.to_string());
|
||||
let mailing_list_address = chat.get_mailinglist_addr().map(|s| s.to_string());
|
||||
|
||||
Ok(FullChat {
|
||||
id: chat_id,
|
||||
|
||||
@@ -2989,7 +2989,7 @@ mod tests {
|
||||
assert!(chat.can_send(&t.ctx).await?);
|
||||
assert_eq!(
|
||||
chat.get_mailinglist_addr(),
|
||||
"reply+elernshsetushoyseshetihseusaferuhsedtisneu@reply.github.com"
|
||||
Some("reply+elernshsetushoyseshetihseusaferuhsedtisneu@reply.github.com")
|
||||
);
|
||||
assert_eq!(chat.name, "deltachat/deltachat-core-rust");
|
||||
assert_eq!(chat::get_chat_contacts(&t.ctx, chat_id).await?.len(), 1);
|
||||
@@ -2998,7 +2998,7 @@ mod tests {
|
||||
|
||||
let chat = chat::Chat::load_from_db(&t.ctx, chat_id).await?;
|
||||
assert!(!chat.can_send(&t.ctx).await?);
|
||||
assert_eq!(chat.get_mailinglist_addr(), "");
|
||||
assert_eq!(chat.get_mailinglist_addr(), None);
|
||||
|
||||
let chats = Chatlist::try_load(&t.ctx, 0, None, None).await?;
|
||||
assert_eq!(chats.len(), 1);
|
||||
@@ -3057,7 +3057,7 @@ mod tests {
|
||||
let chat = Chat::load_from_db(&t.ctx, chat_id).await.unwrap();
|
||||
assert_eq!(chat.name, "delta-dev");
|
||||
assert!(chat.can_send(&t).await?);
|
||||
assert_eq!(chat.get_mailinglist_addr(), "delta@codespeak.net");
|
||||
assert_eq!(chat.get_mailinglist_addr(), Some("delta@codespeak.net"));
|
||||
|
||||
let msg = get_chat_msg(&t, chat_id, 0, 1).await;
|
||||
let contact1 = Contact::load_from_db(&t.ctx, msg.from_id).await.unwrap();
|
||||
@@ -3320,7 +3320,7 @@ Hello mailinglist!\r\n"
|
||||
assert_eq!(chat.name, "ola");
|
||||
assert_eq!(chat::get_chat_msgs(&t, chat.id, 0).await.unwrap().len(), 1);
|
||||
assert!(!chat.can_send(&t).await?);
|
||||
assert_eq!(chat.get_mailinglist_addr(), "");
|
||||
assert_eq!(chat.get_mailinglist_addr(), None);
|
||||
|
||||
// receive another message with no sender name but the same address,
|
||||
// make sure this lands in the same chat
|
||||
@@ -3373,7 +3373,7 @@ Hello mailinglist!\r\n"
|
||||
);
|
||||
assert_eq!(chat.name, "Atlas Obscura");
|
||||
assert!(!chat.can_send(&t).await?);
|
||||
assert_eq!(chat.get_mailinglist_addr(), "");
|
||||
assert_eq!(chat.get_mailinglist_addr(), None);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -3402,7 +3402,7 @@ Hello mailinglist!\r\n"
|
||||
assert_eq!(chat.grpid, "1234ABCD-123LMNO.mailing.dhl.de");
|
||||
assert_eq!(chat.name, "DHL Paket");
|
||||
assert!(!chat.can_send(&t).await?);
|
||||
assert_eq!(chat.get_mailinglist_addr(), "");
|
||||
assert_eq!(chat.get_mailinglist_addr(), None);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -3431,7 +3431,7 @@ Hello mailinglist!\r\n"
|
||||
assert_eq!(chat.grpid, "dpdde.mxmail.service.dpd.de");
|
||||
assert_eq!(chat.name, "DPD");
|
||||
assert!(!chat.can_send(&t).await?);
|
||||
assert_eq!(chat.get_mailinglist_addr(), "");
|
||||
assert_eq!(chat.get_mailinglist_addr(), None);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -3452,7 +3452,7 @@ Hello mailinglist!\r\n"
|
||||
assert_eq!(chat.grpid, "96540.xt.local");
|
||||
assert_eq!(chat.name, "Microsoft Store");
|
||||
assert!(!chat.can_send(&t).await?);
|
||||
assert_eq!(chat.get_mailinglist_addr(), "");
|
||||
assert_eq!(chat.get_mailinglist_addr(), None);
|
||||
|
||||
receive_imf(
|
||||
&t,
|
||||
@@ -3465,7 +3465,7 @@ Hello mailinglist!\r\n"
|
||||
assert_eq!(chat.grpid, "121231234.xt.local");
|
||||
assert_eq!(chat.name, "DER SPIEGEL Kundenservice");
|
||||
assert!(!chat.can_send(&t).await?);
|
||||
assert_eq!(chat.get_mailinglist_addr(), "");
|
||||
assert_eq!(chat.get_mailinglist_addr(), None);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -3488,7 +3488,7 @@ Hello mailinglist!\r\n"
|
||||
assert_eq!(chat.grpid, "51231231231231231231231232869f58.xing.com");
|
||||
assert_eq!(chat.name, "xing.com");
|
||||
assert!(!chat.can_send(&t).await?);
|
||||
assert_eq!(chat.get_mailinglist_addr(), "");
|
||||
assert_eq!(chat.get_mailinglist_addr(), None);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user