mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-29 03:56:33 -05:00
Introduce WalletBuilder for creating test instances of wallet
This commit is contained in:
parent
148fdb8d0a
commit
e4b5e28a93
3 changed files with 73 additions and 33 deletions
|
|
@ -183,11 +183,12 @@ impl Watchable for TxLock {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use crate::bitcoin::wallet::StaticFeeRate;
|
||||
use crate::bitcoin::WalletBuilder;
|
||||
|
||||
#[tokio::test]
|
||||
async fn given_bob_sends_good_psbt_when_reconstructing_then_succeeeds() {
|
||||
let (A, B) = alice_and_bob();
|
||||
let wallet = Wallet::new_funded_default_fees(50000);
|
||||
let wallet = WalletBuilder::new(50_000).build();
|
||||
let agreed_amount = Amount::from_sat(10000);
|
||||
|
||||
let psbt = bob_make_psbt(A, B, &wallet, agreed_amount).await;
|
||||
|
|
@ -201,7 +202,7 @@ mod tests {
|
|||
let (A, B) = alice_and_bob();
|
||||
let fees = 610;
|
||||
let agreed_amount = Amount::from_sat(10000);
|
||||
let wallet = Wallet::new_funded_default_fees(agreed_amount.as_sat() + fees);
|
||||
let wallet = WalletBuilder::new(agreed_amount.as_sat() + fees).build();
|
||||
|
||||
let psbt = bob_make_psbt(A, B, &wallet, agreed_amount).await;
|
||||
assert_eq!(
|
||||
|
|
@ -217,7 +218,7 @@ mod tests {
|
|||
#[tokio::test]
|
||||
async fn given_bob_is_sending_less_than_agreed_when_reconstructing_txlock_then_fails() {
|
||||
let (A, B) = alice_and_bob();
|
||||
let wallet = Wallet::new_funded_default_fees(50000);
|
||||
let wallet = WalletBuilder::new(50_000).build();
|
||||
let agreed_amount = Amount::from_sat(10000);
|
||||
|
||||
let bad_amount = Amount::from_sat(5000);
|
||||
|
|
@ -230,7 +231,7 @@ mod tests {
|
|||
#[tokio::test]
|
||||
async fn given_bob_is_sending_to_a_bad_output_reconstructing_txlock_then_fails() {
|
||||
let (A, B) = alice_and_bob();
|
||||
let wallet = Wallet::new_funded_default_fees(50000);
|
||||
let wallet = WalletBuilder::new(50_000).build();
|
||||
let agreed_amount = Amount::from_sat(10000);
|
||||
|
||||
let E = eve();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue