diff --git a/crates/core/tests/test_spk_client.rs b/crates/core/tests/test_spk_client.rs index 38766ac31..134aba2dd 100644 --- a/crates/core/tests/test_spk_client.rs +++ b/crates/core/tests/test_spk_client.rs @@ -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!( @@ -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" + ); +}