Skip to content

Commit

Permalink
fix e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ank4n committed Nov 28, 2024
1 parent 3c60159 commit 7b04630
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ fn automatic_unbonding_pools() {
assert_eq!(<Runtime as pallet_nomination_pools::Config>::MaxUnbonding::get(), 1);

// init state of pool members.
let init_stakeable_balance_2 = stakeable_balance_for(2);
let init_stakeable_balance_3 = stakeable_balance_for(3);
let init_free_balance_2 = Balances::free_balance(2);
let init_free_balance_3 = Balances::free_balance(3);

let pool_bonded_account = Pools::generate_bonded_account(1);

Expand Down Expand Up @@ -410,7 +410,7 @@ fn automatic_unbonding_pools() {
assert_ok!(Pools::withdraw_unbonded(RuntimeOrigin::signed(2), 2, 10));
assert_eq!(delegated_balance_for(pool_bonded_account), 15);

assert_eq!(stakeable_balance_for(2), 20);
assert_eq!(Balances::free_balance(2), 20);
assert_eq!(TotalValueLocked::<Runtime>::get(), 15);

// 3 cannot withdraw yet.
Expand All @@ -430,8 +430,8 @@ fn automatic_unbonding_pools() {

// final conditions are the expected.
assert_eq!(delegated_balance_for(pool_bonded_account), 5); // 5 init bonded
assert_eq!(stakeable_balance_for(2), init_stakeable_balance_2);
assert_eq!(stakeable_balance_for(3), init_stakeable_balance_3);
assert_eq!(Balances::free_balance(2), init_free_balance_2);
assert_eq!(Balances::free_balance(3), init_free_balance_3);

assert_eq!(TotalValueLocked::<Runtime>::get(), init_tvl);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ impl Default for BalancesExtBuilder {
(100, 100),
(200, 100),
// stashes
(11, 1000),
(11, 1100),
(21, 2000),
(31, 3000),
(41, 4000),
Expand Down Expand Up @@ -954,11 +954,6 @@ pub(crate) fn delegated_balance_for(account_id: AccountId) -> Balance {
DelegatedStaking::agent_balance(Agent::from(account_id)).unwrap_or_default()
}

/// Balance available to be staked for an account.
pub(crate) fn stakeable_balance_for(account_id: AccountId) -> Balance {
pallet_staking::asset::stakeable_balance::<Runtime>(&account_id)
}

pub(crate) fn staking_events() -> Vec<pallet_staking::Event<Runtime>> {
System::events()
.into_iter()
Expand Down

0 comments on commit 7b04630

Please sign in to comment.