add test_insert_item

This commit is contained in:
Rostyslav Tyshko 2024-10-25 00:38:47 +02:00
parent fef23fb3b5
commit 887a8d9600

View File

@ -97,4 +97,22 @@ mod tests {
assert_eq!(smt.store.len(), 0);
}
#[test]
fn test_insert_item() {
let mut smt = UTXOSparseMerkleTree::new();
let utxo = sample_utxo();
let result = smt.insert_item(utxo.clone());
// Test insertion is successful
assert!(result.is_ok());
// Test UTXO is now stored in the tree
assert_eq!(smt.store.get(&utxo.hash).unwrap().hash, utxo.hash);
// Test curr_root is updated
assert!(smt.curr_root.is_some());
}
}