mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-25 20:01:09 +00:00
Add execute_with to TestExternalities (#3793)
This function executes the given closure in a context where the test externalities are set. This makes the srml tests easier to write, as the test externalities need to be created anyway.
This commit is contained in:
@@ -18,12 +18,11 @@
|
||||
|
||||
#![cfg(test)]
|
||||
|
||||
use sr_primitives::set_and_run_with_externalities;
|
||||
use crate::mock::{Aura, new_test_ext};
|
||||
|
||||
#[test]
|
||||
fn initial_values() {
|
||||
set_and_run_with_externalities(&mut new_test_ext(vec![0, 1, 2, 3]), || {
|
||||
new_test_ext(vec![0, 1, 2, 3]).execute_with(|| {
|
||||
assert_eq!(Aura::last(), 0u64);
|
||||
assert_eq!(Aura::authorities().len(), 4);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user