Skip to content

Commit

Permalink
wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
codabrink committed Dec 20, 2024
1 parent e70abb2 commit 5477865
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
18 changes: 13 additions & 5 deletions xmtp_mls/src/storage/encrypted_store/group_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub struct MsgQueryArgs {
pub delivery_status: Option<DeliveryStatus>,
pub limit: Option<i64>,
pub direction: Option<SortDirection>,
content_types: Option<Vec<ContentType>>,
pub content_types: Option<Vec<ContentType>>,
}

impl DbConnection {
Expand Down Expand Up @@ -628,7 +628,10 @@ pub(crate) mod tests {
let text_messages = conn
.get_group_messages(
&group.id,
&MsgQueryArgs::default().content_types(vec![ContentType::Text]),
&MsgQueryArgs {
content_types: vec![ContentType::Text],
..Default::default()
},
)
.unwrap();
assert_eq!(text_messages.len(), 1);
Expand All @@ -639,8 +642,10 @@ pub(crate) mod tests {
let membership_messages = conn
.get_group_messages(
&group.id,
&MsgQueryArgs::default()
.content_types(vec![ContentType::GroupMembershipChange]),
&MsgQueryArgs {
content_types: vec![ContentType::GroupMembershipChange],
..Default::default()
},
)
.unwrap();
assert_eq!(membership_messages.len(), 1);
Expand All @@ -654,7 +659,10 @@ pub(crate) mod tests {
let updated_messages = conn
.get_group_messages(
&group.id,
&MsgQueryArgs::default().content_types(vec![ContentType::GroupUpdated]),
&MsgQueryArgs {
content_types: vec![ContentType::GroupUpdated],
..Default::default()
},
)
.unwrap();
assert_eq!(updated_messages.len(), 1);
Expand Down
4 changes: 4 additions & 0 deletions xmtp_mls/src/storage/encrypted_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,12 @@ pub(crate) mod tests {
let db_path = tmp_path();
let opts = StorageOption::Persistent(db_path.clone());

#[cfg(not(target_arch = "wasm32"))]
let db =
native::NativeDb::new(&opts, Some(EncryptedMessageStore::generate_enc_key())).unwrap();
#[cfg(target_arch = "wasm32")]
let db = wasm::WasmDb::new(&opts).await?;

let store = EncryptedMessageStore { db, opts };
store.db.validate(&store.opts).unwrap();

Expand Down

0 comments on commit 5477865

Please sign in to comment.