Skip to content

Commit 4ace281

Browse files
committed
test(base): Add logged_in_base_client_with_store_config.
This patch adds a small `logged_in_base_client_with_store_config` function similarly to `logged_in_base_client`, but… with… a store config!
1 parent fa18ed4 commit 4ace281

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

crates/matrix-sdk-base/src/test_utils.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,24 @@ use crate::{store::StoreConfig, BaseClient, SessionMeta};
2323
/// Create a [`BaseClient`] with the given user id, if provided, or an hardcoded
2424
/// one otherwise.
2525
pub(crate) async fn logged_in_base_client(user_id: Option<&UserId>) -> BaseClient {
26-
let client = BaseClient::with_store_config(StoreConfig::new(
27-
"cross-process-store-locks-holder-name".to_owned(),
28-
));
26+
logged_in_base_client_with_store_config(
27+
user_id,
28+
StoreConfig::new("cross-process-store-locks-holder-name".to_owned()),
29+
)
30+
.await
31+
}
32+
33+
/// Create a [`BaseClient`] with the given user id, if provided, or an hardcoded
34+
/// one otherwise, and with a store config.
35+
pub(crate) async fn logged_in_base_client_with_store_config(
36+
user_id: Option<&UserId>,
37+
store_config: StoreConfig,
38+
) -> BaseClient {
39+
let client = BaseClient::with_store_config(store_config);
40+
2941
let user_id =
3042
user_id.map(|user_id| user_id.to_owned()).unwrap_or_else(|| owned_user_id!("@u:e.uk"));
43+
3144
client
3245
.set_session_meta(
3346
SessionMeta { user_id: user_id.to_owned(), device_id: "FOOBAR".into() },
@@ -36,5 +49,6 @@ pub(crate) async fn logged_in_base_client(user_id: Option<&UserId>) -> BaseClien
3649
)
3750
.await
3851
.expect("set_session_meta failed!");
52+
3953
client
4054
}

0 commit comments

Comments
 (0)