add test_get_item_not_exists

This commit is contained in:
Rostyslav Tyshko 2024-10-25 00:39:33 +02:00
parent e96b2c58c7
commit 552b285b2f

View File

@ -146,4 +146,19 @@ mod tests {
assert_eq!(retrieved_utxo.unwrap().hash, utxo.hash);
}
#[test]
fn test_get_item_not_exists() {
let mut smt = UTXOSparseMerkleTree::new();
let utxo = sample_utxo();
// Insert one UTXO and try to fetch a different hash
smt.insert_item(utxo).unwrap();
let non_existent_hash = TreeHashType::default();
let result = smt.get_item(non_existent_hash).unwrap();
// Test that retrieval for a non-existent UTXO returns None
assert!(result.is_none());
}
}