Skip to content

Commit 3d18c34

Browse files
committed
split test into two
1 parent 350a874 commit 3d18c34

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/self_reporting/self_reporting_tests.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
use super::*;
22
use crate::chat::Chat;
33
use crate::mimeparser::SystemMessage;
4-
use crate::test_utils::{get_chat_msg, TestContextManager};
4+
use crate::test_utils::{get_chat_msg, TestContext, TestContextManager};
55

66
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
77
async fn test_send_self_report() -> Result<()> {
8-
let mut tcm = TestContextManager::new();
9-
let alice = &tcm.alice().await;
10-
let bob = &tcm.bob().await;
8+
let alice = &TestContext::new_alice().await;
119

1210
alice.set_config_bool(Config::SelfReporting, true).await?;
1311

@@ -35,12 +33,25 @@ async fn test_send_self_report() -> Result<()> {
3533

3634
assert_eq!(maybe_send_self_report(alice).await?, None);
3735

38-
tcm.send_recv_accept(bob, alice, "Hi!").await;
36+
Ok(())
37+
}
38+
39+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
40+
async fn test_self_report_one_contact() -> Result<()> {
41+
let mut tcm = TestContextManager::new();
42+
let alice = &tcm.alice().await;
43+
let bob = &tcm.bob().await;
44+
alice.set_config_bool(Config::SelfReporting, true).await?;
3945

4046
let report = get_self_report(alice).await?;
47+
let r: serde_json::Value = serde_json::from_str(&report)?;
4148

49+
tcm.send_recv_accept(bob, alice, "Hi!").await;
50+
51+
let report = get_self_report(alice).await?;
4252
println!("\nWith Bob:\n{report}\n");
4353
let r2: serde_json::Value = serde_json::from_str(&report)?;
54+
4455
assert_eq!(
4556
r.get("key_created").unwrap(),
4657
r2.get("key_created").unwrap()

0 commit comments

Comments
 (0)