From f1dc03a4eea4651f4021fd1cf30a1d50927490ba Mon Sep 17 00:00:00 2001 From: link2xt Date: Wed, 25 Mar 2026 07:11:01 +0100 Subject: [PATCH] test: do not rely on loading newest chat in load_imf_email() We know which message was added from the return value of receive_imf(). It may be that the first chat in the chatlist is not the one where the message was received if there is a pinned chat or if just received message is old. --- src/receive_imf/receive_imf_tests.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/receive_imf/receive_imf_tests.rs b/src/receive_imf/receive_imf_tests.rs index 935c6b12a..d59af752b 100644 --- a/src/receive_imf/receive_imf_tests.rs +++ b/src/receive_imf/receive_imf_tests.rs @@ -819,9 +819,12 @@ async fn load_imf_email(context: &Context, imf_raw: &[u8]) -> Message { .set_config(Config::ShowEmails, Some("2")) .await .unwrap(); - receive_imf(context, imf_raw, false).await.unwrap(); - let chats = Chatlist::try_load(context, 0, None, None).await.unwrap(); - let msg_id = chats.get_msg_id(0).unwrap().unwrap(); + let received_msg = receive_imf(context, imf_raw, false) + .await + .expect("receive_imf failure") + .expect("No message received"); + assert_eq!(received_msg.msg_ids.len(), 1); + let msg_id = received_msg.msg_ids[0]; Message::load_from_db(context, msg_id).await.unwrap() }