Skip to content

Commit

Permalink
chore/delete-account-test
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasir Shariff committed Aug 21, 2023
1 parent cda1dc4 commit 7c1fbcf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 0 additions & 1 deletion workspaces/src/rpc/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ impl Client {
.await
}

// TODO: write tests that uses delete_account
pub(crate) async fn delete_account(
&self,
signer: &InMemorySigner,
Expand Down
18 changes: 18 additions & 0 deletions workspaces/tests/create_account.rs → workspaces/tests/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,21 @@ async fn test_subaccount_creation() -> anyhow::Result<()> {

Ok(())
}

#[test(tokio::test)]
async fn test_delete_account() -> anyhow::Result<()> {
let worker = workspaces::sandbox().await?;

let (first_account, second_account) = (
worker.dev_create_account().await?,
worker.dev_create_account().await?,
);

_ = first_account.delete_account(second_account.id()).await?;

// All sandbox accounts start with a balance of `1_000_000_000_000_000_000_000_000` tokens.
// On account deletion, first_account balance is debited to second_account as beneficary.
assert!(second_account.view_account().await?.balance > 1_900_000_000_000_000_000_000_000,);

Ok(())
}

0 comments on commit 7c1fbcf

Please sign in to comment.