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

Improve election pallet testing setup and checks  #12184

@kianenigma

Description

@kianenigma

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();
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Z1-easyCan be fixed primarily by duplicating and adapting code by an intermediate coderZ6-mentorAn easy task where a mentor is available. Please indicate in the issue who the mentor could be.

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions