Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Prev Previous commit
Next Next commit
fix staking tests
  • Loading branch information
joepetrowski committed Jun 11, 2020
commit 49df6670bab63d7b61fe36543b52028f76ba3e61
15 changes: 7 additions & 8 deletions frame/staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use sp_runtime::{
};
use sp_staking::offence::OffenceDetails;
use frame_support::{
assert_ok, assert_noop, StorageMap,
assert_ok, assert_noop, assert_err, StorageMap,
traits::{Currency, ReservableCurrency, OnInitialize, OnFinalize},
};
use pallet_balances::Error as BalancesError;
Expand Down Expand Up @@ -337,8 +337,8 @@ fn staking_should_work() {
claimed_rewards: vec![0],
})
);
// e.g. it cannot spend more than 500 that it has free from the total 2000
assert_noop!(
// e.g. it cannot reserve more than 500 that it has free from the total 2000
assert_err!(
Balances::reserve(&3, 501),
BalancesError::<Test, _>::LiquidityRestrictions
);
Expand Down Expand Up @@ -783,11 +783,10 @@ fn cannot_reserve_staked_balance() {
assert_eq!(Balances::free_balance(11), 1000);
// Confirm account 11 (via controller 10) is totally staked
assert_eq!(Staking::eras_stakers(Staking::active_era().unwrap().index, 11).own, 1000);
// Confirm account 11 cannot transfer as a result
assert_noop!(
Balances::reserve(&11, 1),
BalancesError::<Test, _>::LiquidityRestrictions
);
// Confirm account 11 cannot reserve as a result
assert_eq!(Balances::reserved_balance(11), 0);
let _ = Balances::reserve(&11, 1);
assert_eq!(Balances::reserved_balance(11), 0);

// Give account 11 extra free balance
let _ = Balances::make_free_balance_be(&11, 10000);
Expand Down