Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseAbram committed Jan 8, 2025
1 parent 6ed058c commit e4fc3ff
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions crates/client/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::{
bond_account,
chain_api::{
entropy::{
self,
Expand All @@ -7,6 +8,7 @@ use crate::{
pallet_registry::pallet::ProgramInstance,
pallet_staking_extension::pallet::ServerInfo,
},
staking::events as staking_events,
staking_extension::events,
},
get_api, get_rpc,
Expand Down Expand Up @@ -282,3 +284,23 @@ async fn test_get_oracle_headings() {

assert_eq!(headings, vec!["block_number_entropy".to_string()]);
}

#[tokio::test]
#[serial]
async fn test_bond_accounts() {
let one = AccountKeyring::Ferdie;
let substrate_context = test_context_stationary().await;

let api = get_api(&substrate_context.node_proc.ws_url).await.unwrap();
let rpc = get_rpc(&substrate_context.node_proc.ws_url).await.unwrap();
let bond_amount = 10000000000u128;
let reward_destination = AccountId32(one.public().0);
let result = bond_account(&api, &rpc, one.into(), bond_amount, reward_destination.clone())
.await
.unwrap();

assert_eq!(
format!("{:?}", result),
format!("{:?}", staking_events::Bonded { stash: reward_destination, amount: bond_amount })
);
}

0 comments on commit e4fc3ff

Please sign in to comment.