Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions crates/core/tests/test_spk_client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use bdk_chain::local_chain::CheckPoint;
use bdk_core::spk_client::{FullScanResponse, SyncResponse};

use bitcoin::hashes::Hash;
use bitcoin::BlockHash;

#[test]
fn test_empty() {
assert!(
Expand All @@ -11,3 +15,27 @@ fn test_empty() {
"Default `SyncResponse` must be empty"
);
}

#[test]
fn test_sync_response_not_empty_when_chain_update_present() {
let mut resp = SyncResponse::<()>::default();

let bh = BlockHash::from_byte_array([0u8; 32]);
resp.chain_update = Some(CheckPoint::new(0, bh));

assert!(
!resp.is_empty(),
"SyncResponse must not be empty when chain_update is present"
);
}

#[test]
fn test_full_scan_response_not_empty_when_last_active_indices_present() {
let mut resp = FullScanResponse::<(), ()>::default();
resp.last_active_indices.insert((), 0);

assert!(
!resp.is_empty(),
"FullScanResponse must not be empty when last_active_indices is present"
);
}
Loading