Skip to content

Commit 6fb45d8

Browse files
committed
test(bdk): add test_list_output
1 parent e803ee9 commit 6fb45d8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

crates/bdk/tests/wallet.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,25 @@ fn test_get_funded_wallet_tx_fee_rate() {
237237
assert_eq!(tx_fee_rate.as_sat_per_vb(), 8.849558);
238238
}
239239

240+
#[test]
241+
fn test_list_output() {
242+
let (wallet, txid) = get_funded_wallet(get_test_wpkh());
243+
let txos = wallet
244+
.list_output()
245+
.map(|op| (op.outpoint, op))
246+
.collect::<std::collections::BTreeMap<_, _>>();
247+
assert_eq!(txos.len(), 2);
248+
for (op, txo) in txos {
249+
if op.txid == txid {
250+
assert_eq!(txo.txout.value, 50_000);
251+
assert!(!txo.is_spent);
252+
} else {
253+
assert_eq!(txo.txout.value, 76_000);
254+
assert!(txo.is_spent);
255+
}
256+
}
257+
}
258+
240259
macro_rules! assert_fee_rate {
241260
($psbt:expr, $fees:expr, $fee_rate:expr $( ,@dust_change $( $dust_change:expr )* )* $( ,@add_signature $( $add_signature:expr )* )* ) => ({
242261
let psbt = $psbt.clone();

0 commit comments

Comments
 (0)