Skip to content

Commit 57e0b5b

Browse files
committed
test: messages without recipients are assigned to self chat
Previously such messages were assigned to trash.
1 parent 5b6a86f commit 57e0b5b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/receive_imf/tests.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,6 +2200,29 @@ Message content",
22002200
assert_ne!(msg.chat_id, t.get_self_chat().await.id);
22012201
}
22022202

2203+
/// Tests that message with hidden recipients is assigned to Saved Messages chat.
2204+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
2205+
async fn test_hidden_recipients_self_chat() {
2206+
let t = TestContext::new_alice().await;
2207+
2208+
receive_imf(
2209+
&t,
2210+
b"Subject: s
2211+
Chat-Version: 1.0
2212+
Message-ID: <foobar@localhost>
2213+
To: hidden-recipients:;
2214+
From: <alice@example.org>
2215+
2216+
Message content",
2217+
false,
2218+
)
2219+
.await
2220+
.unwrap();
2221+
2222+
let msg = t.get_last_msg().await;
2223+
assert_eq!(msg.chat_id, t.get_self_chat().await.id);
2224+
}
2225+
22032226
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
22042227
async fn test_no_unencrypted_name_in_self_chat() -> Result<()> {
22052228
let mut tcm = TestContextManager::new();

0 commit comments

Comments
 (0)