Skip to content

Commit 9428300

Browse files
author
José Molina
committed
Complete test
1 parent b205dee commit 9428300

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/tests.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3861,7 +3861,7 @@ mod collator_rewards {
38613861
register_candidates(4..=4);
38623862
lock_for_staking(3..=3);
38633863

3864-
// Staker 3 stakes on candidate 4
3864+
// Staker 3 stakes on candidate 4.
38653865
assert_ok!(CollatorStaking::stake(
38663866
RuntimeOrigin::signed(3),
38673867
vec![StakeTarget { candidate: 4, stake: 40 }].try_into().unwrap()
@@ -3904,6 +3904,22 @@ mod collator_rewards {
39043904
CandidateStake::<Test>::get(&4, &3).checkpoint,
39053905
FixedU128::from_rational(8, 40)
39063906
);
3907+
3908+
// Now let's imagine staker 5 also joins.
3909+
lock_for_staking(5..=5);
3910+
3911+
// Staker 5 stakes on candidate 4.
3912+
assert_ok!(CollatorStaking::stake(
3913+
RuntimeOrigin::signed(5),
3914+
vec![StakeTarget { candidate: 4, stake: 40 }].try_into().unwrap()
3915+
));
3916+
3917+
// The checkpoint should be equal to the candidate's current counter.
3918+
assert_eq!(Counters::<Test>::get(&4), FixedU128::from_rational(8, 40));
3919+
assert_eq!(
3920+
CandidateStake::<Test>::get(&4, &3).checkpoint,
3921+
FixedU128::from_rational(8, 40)
3922+
);
39073923
});
39083924
}
39093925
}

0 commit comments

Comments
 (0)