use crate::common::{self, Args, NodeExec, Result};
use gsdk::Api;
const SURI: &str = "tumble tenant update heavy sad draw present tray atom chunk animal exhaust";
const ADDRESS: &str = "kGhmTEymraqSPa1NYjXzqbko2p4Ge1CmEfACtC1s4aC5hTPYk";
#[tokio::test]
async fn test_command_transfer_works() -> Result<()> {
let node = common::dev()?;
let signer = Api::new(node.ws().as_str()).await?.signer(SURI, None)?;
let before = signer.api().get_balance(ADDRESS).await.unwrap_or(0);
let value = 1_000_000_000_000_000u128;
let _ = node.run(
Args::new("transfer")
.destination(ADDRESS)
.amount(value.to_string()),
)?;
let after = signer.api().get_balance(ADDRESS).await.unwrap_or(0);
assert_eq!(
after.saturating_sub(before),
value,
"Alice should have received {value}. Balance must be {correct_balance}, but now it is {after}",
correct_balance = before.saturating_add(value)
);
Ok(())
}