mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-09 08:43:12 +00:00
add test_put_and_get_block
This commit is contained in:
parent
e77cd830c7
commit
f4fce6555a
@ -99,4 +99,21 @@ mod tests {
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_put_and_get_block() {
|
||||
let temp_dir = tempdir().unwrap();
|
||||
let path = temp_dir.path();
|
||||
|
||||
let genesis_block = create_genesis_block();
|
||||
let node_store = NodeBlockStore::open_db_with_genesis(path, Some(genesis_block)).unwrap();
|
||||
|
||||
let block = create_sample_block(1, 0);
|
||||
node_store.put_block_at_id(block.clone()).unwrap();
|
||||
|
||||
let retrieved_block = node_store.get_block_at_id(1).unwrap();
|
||||
assert_eq!(retrieved_block.block_id, block.block_id);
|
||||
assert_eq!(retrieved_block.hash, block.hash);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user