mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2024-12-25 23:49:31 -05:00
50ed74319f
- Make it the same for Alice and Bob. - Make it contain a wallet client instead of the `Monero` struct. Also: Remove `Container` from inside `Monero` struct. The caller of `new` can simply ensure that `Container` is not dropped to keep the container alive. This makes the `Monero` struct easier to work with, as it just holds the data necessary to create the different clients created during `init`, and does not have any lifetime restrictions.
32 lines
854 B
Rust
32 lines
854 B
Rust
use monero_harness::Monero;
|
|
use spectral::prelude::*;
|
|
use testcontainers::clients::Cli;
|
|
|
|
const ALICE_FUND_AMOUNT: u64 = 1_000_000_000_000;
|
|
const BOB_FUND_AMOUNT: u64 = 0;
|
|
|
|
#[tokio::test]
|
|
async fn init_accounts_for_alice_and_bob() {
|
|
let tc = Cli::default();
|
|
let (monero, _container) = Monero::new(&tc);
|
|
monero
|
|
.init(ALICE_FUND_AMOUNT, BOB_FUND_AMOUNT)
|
|
.await
|
|
.unwrap();
|
|
|
|
let got_balance_alice = monero
|
|
.alice_wallet_rpc_client()
|
|
.get_balance(0)
|
|
.await
|
|
.expect("failed to get alice's balance");
|
|
|
|
let got_balance_bob = monero
|
|
.bob_wallet_rpc_client()
|
|
.get_balance(0)
|
|
.await
|
|
.expect("failed to get bob's balance");
|
|
|
|
assert_that!(got_balance_alice).is_equal_to(ALICE_FUND_AMOUNT);
|
|
assert_that!(got_balance_bob).is_equal_to(BOB_FUND_AMOUNT);
|
|
}
|