-
Notifications
You must be signed in to change notification settings - Fork 756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes all tests and removes a few nits #6595
Fixes all tests and removes a few nits #6595
Conversation
@@ -128,10 +128,6 @@ pub use types::*; | |||
|
|||
pub use crate::{unsigned::miner, verifier::Verifier, weights::WeightInfo}; | |||
|
|||
/// Internal crate re-exports to use across benchmarking and tests. | |||
#[cfg(any(test, feature = "runtime-benchmarks"))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really needed anymore.
@@ -291,7 +291,7 @@ pub struct ExtBuilder { | |||
|
|||
impl Default for ExtBuilder { | |||
fn default() -> Self { | |||
Self { core_try_state: true, signed_try_state: true, minimum_score: Some(Default::default()) } | |||
Self { core_try_state: true, signed_try_state: true, minimum_score: None } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so that the default Election score passes, simplifies tests
@@ -438,6 +438,7 @@ impl ExtBuilder { | |||
|
|||
pub(crate) fn build_and_execute(self, test: impl FnOnce() -> ()) { | |||
let mut ext = self.build(); | |||
ext.execute_with(|| roll_one()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
starts by rolling one block so that the System events are initialized. Otherwise they won't be catched and don't show up in the tests.
@@ -281,7 +276,7 @@ mod calls { | |||
|
|||
assert_err!( | |||
SignedPallet::register(RuntimeOrigin::signed(account_id), Default::default()), | |||
NotAcceptingSubmissions::<Runtime>, | |||
Error::<T>::NotAcceptingSubmissions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
easier to read
} | ||
|
||
#[test] | ||
fn force_clear_submission_fails_if_called_by_account_none() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really relevant.
); | ||
}) | ||
} | ||
|
||
#[test] | ||
fn force_clear_submission_fails_if_called_in_phase_other_than_off() { | ||
ExtBuilder::default().build_and_execute(|| { | ||
let some_bn = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't need to be a separate variable, otherwise the developer will think this is important value to the tests.
} | ||
|
||
#[test] | ||
fn force_clear_submission_removes_both_metadata_and_submission_pages() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test that covers all these cases, so we can drop this one.
@@ -273,51 +273,6 @@ mod miner { | |||
}); | |||
} | |||
|
|||
#[test] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not very relevant, we should test the case that the signed/unsigned phases pass without a solution and that's it.
/// A verificaction failed at the given page. | ||
VerificationFailed(PageIndex, FeasibilityError), | ||
VerificationFailed { page: PageIndex, error: FeasibilityError }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a refactor needed from the base PR
@@ -535,17 +538,8 @@ mod hooks { | |||
use frame_support::traits::Hooks; | |||
|
|||
#[test] | |||
fn on_initialize_status_nothing_returns_default_value() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not very relevant.
All GitHub workflows were cancelled due to failure one of the required jobs. |
All GitHub workflows were cancelled due to failure one of the required jobs. |
d0252be
into
zebedeusz/pallet-epm-mb-unit-tests
No description provided.