From ed2a3a76b47eb1b3d4f9f6d5ad886f68b7fede9d Mon Sep 17 00:00:00 2001 From: link2xt Date: Sat, 4 Jan 2025 20:57:14 +0000 Subject: [PATCH] test: messages without recipients are assigned to self chat Previously such messages were assigned to trash. --- src/receive_imf/tests.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/receive_imf/tests.rs b/src/receive_imf/tests.rs index 0bb83ceb9..333f03f10 100644 --- a/src/receive_imf/tests.rs +++ b/src/receive_imf/tests.rs @@ -2200,6 +2200,29 @@ Message content", assert_ne!(msg.chat_id, t.get_self_chat().await.id); } +/// Tests that message with hidden recipients is assigned to Saved Messages chat. +#[tokio::test(flavor = "multi_thread", worker_threads = 2)] +async fn test_hidden_recipients_self_chat() { + let t = TestContext::new_alice().await; + + receive_imf( + &t, + b"Subject: s +Chat-Version: 1.0 +Message-ID: +To: hidden-recipients:; +From: + +Message content", + false, + ) + .await + .unwrap(); + + let msg = t.get_last_msg().await; + assert_eq!(msg.chat_id, t.get_self_chat().await.id); +} + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_no_unencrypted_name_in_self_chat() -> Result<()> { let mut tcm = TestContextManager::new();