add test_get_item_exists

This commit is contained in:
Rostyslav Tyshko 2024-10-25 00:39:20 +02:00
parent c14b5a59be
commit e96b2c58c7

View File

@ -133,4 +133,17 @@ mod tests {
assert!(smt.curr_root.is_some());
}
#[test]
fn test_get_item_exists() {
let mut smt = UTXOSparseMerkleTree::new();
let utxo = sample_utxo();
smt.insert_item(utxo.clone()).unwrap();
// Test that the UTXO can be retrieved by hash
let retrieved_utxo = smt.get_item(utxo.hash).unwrap();
assert!(retrieved_utxo.is_some());
assert_eq!(retrieved_utxo.unwrap().hash, utxo.hash);
}
}