substrate icon indicating copy to clipboard operation
substrate copied to clipboard

Improve election pallet testing setup and checks

Open kianenigma opened this issue 3 years ago • 1 comments

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: https://github.com/paritytech/substrate/pull/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().

https://github.com/paritytech/substrate/blob/d7e45e51882b403bd744eb13f60d55b64830fcdb/frame/election-provider-multi-block/src/mock/mod.rs#L548-L559

kianenigma avatar Sep 04 '22 18:09 kianenigma

I will give this a try.

Szegoo avatar Sep 21 '22 12:09 Szegoo