Skip to content

Commit

Permalink
test: Order of messages if Sentbox is synced before Inbox
Browse files Browse the repository at this point in the history
  • Loading branch information
iequidoo committed Jul 29, 2024
1 parent 4ec5d12 commit 4ea6d9d
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/receive_imf/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4691,6 +4691,40 @@ async fn test_protected_group_add_remove_member_missing_key() -> Result<()> {
Ok(())
}

/// Alice is offline for some time.
/// When she comes online, first her sentbox is synced and then her inbox.
/// This tests that the messages are still in the right order.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_sync_sentbox_then_inbox() -> Result<()> {
let alice = &TestContext::new_alice().await;
let msg_sent = receive_imf(
alice,
b"From: [email protected]\n\
To: Bob <[email protected]>\n\
Message-ID: <[email protected]>\n\
Date: Sat, 09 Dec 2019 19:00:27 +0000\n\
\n\
Thanks, Bob!\n",
true,
)
.await?
.unwrap();
let msg_incoming = receive_imf(
alice,
b"From: Bob <[email protected]>\n\
To: [email protected]\n\
Message-ID: <[email protected]>\n\
Date: Sun, 08 Dec 2019 19:00:27 +0000\n\
\n\
Happy birthday, Alice!\n",
true,
)
.await?
.unwrap();
assert!(msg_incoming.sort_timestamp < msg_sent.sort_timestamp);
Ok(())
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_dont_create_adhoc_group_on_member_removal() -> Result<()> {
let mut tcm = TestContextManager::new();
Expand Down

0 comments on commit 4ea6d9d

Please sign in to comment.