Skip to content

Commit

Permalink
test: added test for in with only some elements (dashpay/rs-platform#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumExplorer authored Mar 8, 2022
1 parent 01550ea commit ab1a46f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/rs-drive/tests/query_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,33 @@ fn test_query() {

// using non existing document in startAt

let query_value = json!({
"where": [
["$id", "in", [String::from("ATxXeP5AvY4aeUFA6WRo7uaBKTBgPQCjTrgtNpCMNVRD"), String::from("5A8SGgdmj2NtWCYoYDPDpbsYkq2MCbgi6Lx4ALLfF178")]],
],
"orderBy": [["$id", "asc"]],
});

let query_cbor = common::value_to_cbor(query_value, None);

let person_document_type = contract
.document_types
.get("person")
.expect("contract should have a person document type");

let (results, _) = drive
.query_documents_from_contract(
&contract,
person_document_type,
query_cbor.as_slice(),
Some(&db_transaction),
)
.expect("query should be executed");

assert_eq!(results.len(), 1);

// using non existing document in startAt

let query_value = json!({
"where": [
["$id", "in", [String::from("ATxXeP5AvY4aeUFA6WRo7uaBKTBgPQCjTrgtNpCMNVRD"), String::from("6A8SGgdmj2NtWCYoYDPDpbsYkq2MCbgi6Lx4ALLfF179")]],
Expand Down

0 comments on commit ab1a46f

Please sign in to comment.