Skip to content

Commit 6420c27

Browse files
committed
add failing test
1 parent 34a5681 commit 6420c27

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/webxdc/webxdc_tests.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use crate::chatlist::Chatlist;
1212
use crate::config::Config;
1313
use crate::download::DownloadState;
1414
use crate::ephemeral;
15+
use crate::message::delete_msgs;
1516
use crate::receive_imf::{receive_imf, receive_imf_from_inbox};
1617
use crate::test_utils::{E2EE_INFO_MSGS, TestContext, TestContextManager};
1718
use crate::tools::{self, SystemTime};
@@ -1616,6 +1617,26 @@ async fn test_webxdc_info_msg_no_cleanup_on_interrupted_series() -> Result<()> {
16161617
Ok(())
16171618
}
16181619

1620+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
1621+
async fn test_webxdc_info_msg_delete() -> Result<()> {
1622+
let t = TestContext::new_alice().await;
1623+
let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "c").await?;
1624+
let instance = send_webxdc_instance(&t, chat_id).await?;
1625+
1626+
t.send_webxdc_status_update(instance.id, r#"{"info":"i1", "payload":1}"#)
1627+
.await?;
1628+
assert_eq!(chat_id.get_msg_cnt(&t).await?, 2);
1629+
send_text_msg(&t, chat_id, "msg between info".to_string()).await?;
1630+
assert_eq!(chat_id.get_msg_cnt(&t).await?, 3);
1631+
t.send_webxdc_status_update(instance.id, r#"{"info":"i2", "payload":2}"#)
1632+
.await?;
1633+
assert_eq!(chat_id.get_msg_cnt(&t).await?, 4);
1634+
delete_msgs(&t, &[instance.id]).await?;
1635+
assert_eq!(chat_id.get_msg_cnt(&t).await?, 1);
1636+
1637+
Ok(())
1638+
}
1639+
16191640
// check that `info.internet_access` is not set for normal, non-integrated webxdc -
16201641
// even if they use the deprecated option `request_internet_access` in manifest.toml
16211642
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]

0 commit comments

Comments
 (0)