diff --git a/src/message.rs b/src/message.rs index da3bd9025..4bfad2d56 100644 --- a/src/message.rs +++ b/src/message.rs @@ -1987,8 +1987,9 @@ mod tests { use num_traits::FromPrimitive; use super::*; - use crate::chat::{self, marknoticed_chat, ChatItem}; + use crate::chat::{self, marknoticed_chat, send_text_msg, ChatItem}; use crate::chatlist::Chatlist; + use crate::reaction::send_reaction; use crate::receive_imf::receive_imf; use crate::test_utils as test; use crate::test_utils::{TestContext, TestContextManager}; @@ -2478,6 +2479,24 @@ mod tests { Ok(()) } + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] + async fn test_get_message_summary_text() -> Result<()> { + let t = TestContext::new_alice().await; + let chat = t.get_self_chat().await; + let msg_id = send_text_msg(&t, chat.id, "foo".to_string()).await?; + let msg = Message::load_from_db(&t, msg_id).await?; + let summary = msg.get_summary(&t, None).await?; + assert_eq!(summary.text, "foo"); + + // message summary does not change when reactions are applied (in contrast to chatlist summary) + send_reaction(&t, msg_id, "🫵").await?; + let msg = Message::load_from_db(&t, msg_id).await?; + let summary = msg.get_summary(&t, None).await?; + assert_eq!(summary.text, "foo"); + + Ok(()) + } + #[tokio::test(flavor = "multi_thread", worker_threads = 2)] async fn test_format_flowed_round_trip() -> Result<()> { let mut tcm = TestContextManager::new();