Skip to content

Commit 351d7e6

Browse files
committed
add test
1 parent c5658fb commit 351d7e6

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
@@ -2196,3 +2196,24 @@ async fn test_webxdc_href() -> Result<()> {
21962196

21972197
Ok(())
21982198
}
2199+
2200+
/// Test that the draft `selfAddr` is equal to the `selfAddr` of the sent message.
2201+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
2202+
async fn test_self_addr_consistency() -> Result<()> {
2203+
let mut tcm = TestContextManager::new();
2204+
let alice = &tcm.alice().await;
2205+
let alice_chat = alice
2206+
.create_group_with_members(ProtectionStatus::Unprotected, "No friends :(", &[])
2207+
.await;
2208+
let mut instance = create_webxdc_instance(
2209+
alice,
2210+
"minimal.xdc",
2211+
include_bytes!("../../test-data/webxdc/minimal.xdc"),
2212+
)?;
2213+
alice_chat.set_draft(alice, Some(&mut instance)).await?;
2214+
let self_addr = instance.get_webxdc_self_addr(alice).await?;
2215+
let sent = alice.send_msg(alice_chat, &mut instance).await;
2216+
let db_msg = Message::load_from_db(alice, sent.sender_msg_id).await?;
2217+
assert_eq!(db_msg.get_webxdc_self_addr(alice).await?, self_addr);
2218+
Ok(())
2219+
}

0 commit comments

Comments
 (0)