refactor: Add test_utils::sync()

Add a function that pops a sync message from one Alice's device and receives it on another.
This commit is contained in:
iequidoo
2023-11-24 16:53:56 -03:00
committed by iequidoo
parent 1f336f89a6
commit 073c250fa4
3 changed files with 27 additions and 32 deletions

View File

@@ -1067,6 +1067,13 @@ pub(crate) async fn mark_as_verified(this: &TestContext, other: &TestContext) {
peerstate.save_to_db(&this.sql).await.unwrap();
}
/// Pops a sync message from alice0 and receives it on alice1. Should be used after an action on
/// alice0's side that implies sending a sync message.
pub(crate) async fn sync(alice0: &TestContext, alice1: &TestContext) {
let sync_msg = alice0.pop_sent_msg().await;
alice1.recv_msg(&sync_msg).await;
}
/// Pretty-print an event to stdout
///
/// Done during tests this is captured by `cargo test` and associated with the test itself.