Merge pull request #338 from nuttycom/fix_spurious_proptest_error

Fix generation of zip321 URIs for proptest to avoid generating invalid ones
This commit is contained in:
Kris Nuttycombe 2021-02-06 08:32:22 -07:00 committed by GitHub
commit 97b94e758a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -623,6 +623,7 @@ mod parse {
#[cfg(feature = "test-dependencies")]
pub mod testing {
use proptest::collection::btree_map;
use proptest::collection::vec;
use proptest::option;
use proptest::prelude::{any, prop_compose, prop_oneof};
@ -659,7 +660,8 @@ pub mod testing {
memo in option::of(arb_valid_memo()),
message in option::of(any::<String>()),
label in option::of(any::<String>()),
other_params in vec((VALID_PARAMNAME, any::<String>()), 0..3),
// prevent duplicates by generating a set rather than a vec
other_params in btree_map(VALID_PARAMNAME, any::<String>(), 0..3),
) -> Payment {
let is_sapling = match recipient_address {
@ -673,7 +675,7 @@ pub mod testing {
memo: memo.filter(|_| is_sapling),
label,
message,
other_params,
other_params: other_params.into_iter().collect(),
}
}
}