Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Improve election pallet testing setup and checks #12184

Closed
kianenigma opened this issue Sep 4, 2022 · 1 comment · Fixed by #12327
Closed

Improve election pallet testing setup and checks #12184

kianenigma opened this issue Sep 4, 2022 · 1 comment · Fixed by #12327
Labels
Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.

Comments

@kianenigma
Copy link
Contributor

Recently, we added some events to some of the tests in pallet-election-provider-multi-phase.

This is generally a good patterns and I want all tests to basically finish with an assertion over the events that got fired during the tests. The author should verify that the events are sensible to the best of their abilities.

Here is another example: #11343

Lastly, in some experimental work, I've replaced all of the roll_to(x) to roll_to_eventName. We want all tests to use this pattern as well, for less breaking changes.

For example, almost all of the cases where we roll_to(15), we want to roll_to_unsigned().

pub fn roll_to_unsigned_open() {
while !matches!(MultiBlock::current_phase(), Phase::Unsigned(_)) {
roll_next()
}
}
/// proceed block number to whenever the signed phase is open (`Phase::Signed(_)`).
pub fn roll_to_signed_open() {
while !matches!(MultiBlock::current_phase(), Phase::Signed) {
roll_next();
}
}

@kianenigma kianenigma added Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be. Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder labels Sep 4, 2022
@kianenigma kianenigma moved this to 📕 Backlog in (Nominated) Proof of Stake Sep 4, 2022
@Szegoo
Copy link
Contributor

Szegoo commented Sep 21, 2022

I will give this a try.

Repository owner moved this from 📕 Backlog to ✅ Done in (Nominated) Proof of Stake Oct 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Z1-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder Z6-mentor An easy task where a mentor is available. Please indicate in the issue who the mentor could be.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants