Skip to content

Commit

Permalink
add send query test
Browse files Browse the repository at this point in the history
  • Loading branch information
kayhhh committed May 10, 2024
1 parent cc0bdac commit b9b510c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion crates/dwn-server/tests/send.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use didkit::{
};
use dwn::{
actor::{Actor, MessageBuilder},
message::descriptor::records::RecordsFilter,
store::SurrealStore,
DWN,
};
Expand Down Expand Up @@ -119,10 +120,23 @@ async fn test_send() {

// Send a message to alice via their DID.
let read = bob_kyoto
.read_record(create.record_id)
.read_record(create.record_id.clone())
.target(alice_did.clone())
.send(&alice_did)
.await
.unwrap();
assert_eq!(read.status.code, 200);

// Query via alice DID.
let query = bob_kyoto
.query_records(RecordsFilter {
record_id: Some(create.record_id),
..Default::default()
})
.target(alice_did.clone())
.send(&alice_did)
.await
.unwrap();
assert_eq!(query.status.code, 200);
assert!(!query.entries.is_empty());
}

0 comments on commit b9b510c

Please sign in to comment.