From ab1a46fa530e938dd3139d679dd4090b6ea902b8 Mon Sep 17 00:00:00 2001 From: QuantumExplorer Date: Tue, 8 Mar 2022 16:50:12 +0700 Subject: [PATCH] test: added test for in with only some elements (dashpay/rs-platform#81) --- packages/rs-drive/tests/query_tests.rs | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/packages/rs-drive/tests/query_tests.rs b/packages/rs-drive/tests/query_tests.rs index 0f93b4bc1d8..9e4b363c18e 100644 --- a/packages/rs-drive/tests/query_tests.rs +++ b/packages/rs-drive/tests/query_tests.rs @@ -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")]],