mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 23:06:32 +03:00
fixes from merge with master
This commit is contained in:
@@ -1780,37 +1780,35 @@ mod tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[async_std::test]
|
||||||
fn test_is_known_rfc724_mid() {
|
async fn test_is_known_rfc724_mid() {
|
||||||
let t = dummy_context();
|
let t = dummy_context().await;
|
||||||
let mut msg = Message::new(Viewtype::Text);
|
let mut msg = Message::new(Viewtype::Text);
|
||||||
msg.text = Some("first message".to_string());
|
msg.text = Some("first message".to_string());
|
||||||
let msg_id = chat::add_device_msg(&t.ctx, None, Some(&mut msg)).unwrap();
|
let msg_id = chat::add_device_msg(&t.ctx, None, Some(&mut msg))
|
||||||
let msg = Message::load_from_db(&t.ctx, msg_id).unwrap();
|
.await
|
||||||
|
.unwrap();
|
||||||
|
let msg = Message::load_from_db(&t.ctx, msg_id).await.unwrap();
|
||||||
|
|
||||||
// Message-IDs may or may not be surrounded by angle brackets
|
// Message-IDs may or may not be surrounded by angle brackets
|
||||||
assert!(is_known_rfc724_mid(
|
assert!(is_known_rfc724_mid(&t.ctx, format!("<{}>", msg.rfc724_mid).as_str()).await);
|
||||||
&t.ctx,
|
assert!(is_known_rfc724_mid(&t.ctx, &msg.rfc724_mid).await);
|
||||||
format!("<{}>", msg.rfc724_mid).as_str()
|
assert!(!is_known_rfc724_mid(&t.ctx, "nonexistant@message.id").await);
|
||||||
));
|
|
||||||
assert!(is_known_rfc724_mid(&t.ctx, &msg.rfc724_mid));
|
|
||||||
assert!(!is_known_rfc724_mid(&t.ctx, "nonexistant@message.id"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[async_std::test]
|
||||||
fn test_is_msgrmsg_rfc724_mid() {
|
async fn test_is_msgrmsg_rfc724_mid() {
|
||||||
let t = dummy_context();
|
let t = dummy_context().await;
|
||||||
let mut msg = Message::new(Viewtype::Text);
|
let mut msg = Message::new(Viewtype::Text);
|
||||||
msg.text = Some("first message".to_string());
|
msg.text = Some("first message".to_string());
|
||||||
let msg_id = chat::add_device_msg(&t.ctx, None, Some(&mut msg)).unwrap();
|
let msg_id = chat::add_device_msg(&t.ctx, None, Some(&mut msg))
|
||||||
let msg = Message::load_from_db(&t.ctx, msg_id).unwrap();
|
.await
|
||||||
|
.unwrap();
|
||||||
|
let msg = Message::load_from_db(&t.ctx, msg_id).await.unwrap();
|
||||||
|
|
||||||
// Message-IDs may or may not be surrounded by angle brackets
|
// Message-IDs may or may not be surrounded by angle brackets
|
||||||
assert!(is_msgrmsg_rfc724_mid(
|
assert!(is_msgrmsg_rfc724_mid(&t.ctx, format!("<{}>", msg.rfc724_mid).as_str()).await);
|
||||||
&t.ctx,
|
assert!(is_msgrmsg_rfc724_mid(&t.ctx, &msg.rfc724_mid).await);
|
||||||
format!("<{}>", msg.rfc724_mid).as_str()
|
assert!(!is_msgrmsg_rfc724_mid(&t.ctx, "nonexistant@message.id").await);
|
||||||
));
|
|
||||||
assert!(is_msgrmsg_rfc724_mid(&t.ctx, &msg.rfc724_mid));
|
|
||||||
assert!(!is_msgrmsg_rfc724_mid(&t.ctx, "nonexistant@message.id"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user