Skip to content

Commit

Permalink
mint-pay-swap: fix broken unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
xxxxxxxxxxxxx committed Nov 19, 2023
1 parent fdb8460 commit ca2ebcf
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/contract/money/tests/mint_pay_swap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ fn mint_pay_swap() -> Result<()> {
.await?;
}

// Alice should now have one OwnCoin with the change from the above transaction.
let alice_oc = th.gather_owncoin_at_index(&Holder::Alice, &transfer_params.outputs, 0)?;
alice_owncoins.push(alice_oc);

// Bob should now have this new one.
let bob_oc = th.gather_owncoin_at_index(&Holder::Bob, &transfer_params.outputs, 1)?;
// Bob should now have a new OwnCoin.
let bob_oc = th.gather_owncoin_at_index(&Holder::Bob, &transfer_params.outputs, 0)?;
bob_owncoins.push(bob_oc);

// Alice should now have one OwnCoin with the change from the above transfer.
let alice_oc = th.gather_owncoin_at_index(&Holder::Alice, &transfer_params.outputs, 1)?;
alice_owncoins.push(alice_oc);

assert!(alice_owncoins.len() == 1);
assert!(bob_owncoins.len() == 2);

Expand Down Expand Up @@ -171,11 +171,11 @@ fn mint_pay_swap() -> Result<()> {
}

// Alice should now have two OwnCoins
let alice_oc = th.gather_owncoin_at_index(&Holder::Alice, &transfer_params.outputs, 1)?;
let alice_oc = th.gather_owncoin_at_index(&Holder::Alice, &transfer_params.outputs, 0)?;
alice_owncoins.push(alice_oc);

// Bob should have two with the change from the above tx
let bob_oc = th.gather_owncoin_at_index(&Holder::Bob, &transfer_params.outputs, 0)?;
let bob_oc = th.gather_owncoin_at_index(&Holder::Bob, &transfer_params.outputs, 1)?;
bob_owncoins.push(bob_oc);

assert!(alice_owncoins.len() == 2);
Expand Down Expand Up @@ -325,6 +325,8 @@ fn mint_pay_swap() -> Result<()> {
.await?;
}

assert_eq!(otc_swap_params.outputs.len(), 2);

// Alice should now have Bob's BOB tokens
let alice_oc = th.gather_owncoin_at_index(&Holder::Alice, &otc_swap_params.outputs, 0)?;
alice_owncoins.push(alice_oc);
Expand Down

0 comments on commit ca2ebcf

Please sign in to comment.