mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-06 16:08:08 +00:00
Make test-client generic over runtime (#2824)
* Make test-client generic over runtime. * Make sure genesis storage is constructed correctly. * Use prelude in tests. * Add an example of how to use test-client with node/runtime. * Bump version. * Rename test-clients.
This commit is contained in:
committed by
Bastian Köcher
parent
cae324598f
commit
ad2d958248
@@ -17,6 +17,7 @@ node-primitives = { path = "../primitives" }
|
||||
node-runtime = { path = "../runtime" }
|
||||
|
||||
[dev-dependencies]
|
||||
test-client = { package = "substrate-test-client", path = "../../core/test-client" }
|
||||
keyring = { package = "substrate-keyring", path = "../../core/keyring" }
|
||||
runtime_primitives = { package = "sr-primitives", path = "../../core/sr-primitives" }
|
||||
runtime_support = { package = "srml-support", path = "../../srml/support" }
|
||||
|
||||
@@ -895,6 +895,21 @@ mod tests {
|
||||
assert!(t.storage_changes_root(GENESIS_HASH.into()).unwrap().is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn should_import_block_with_test_client() {
|
||||
use test_client::{ClientExt, TestClientBuilder, consensus::BlockOrigin};
|
||||
|
||||
let client = TestClientBuilder::default()
|
||||
.build_with_native_executor::<Block, node_runtime::RuntimeApi, _>(executor())
|
||||
.0;
|
||||
|
||||
let block1 = changes_trie_block();
|
||||
let block_data = block1.0;
|
||||
let block = Block::decode(&mut &block_data[..]).unwrap();
|
||||
|
||||
client.import(BlockOrigin::Own, block).unwrap();
|
||||
}
|
||||
|
||||
#[cfg(feature = "benchmarks")]
|
||||
mod benches {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user