use frame_support::{parameter_types, traits::Everything}; use frame_system as system; use sp_core::H256; use sp_runtime::{ traits::{BlakeTwo256, IdentityLookup}, BuildStorage, }; type Block = frame_system::mocking::MockBlock; // Configure a mock runtime to test the pallet. frame_support::construct_runtime!( pub enum Test { System: frame_system::{Pallet, Call, Config, Storage, Event}, TemplateModule: crate::{Pallet, Call, Storage, Event}, } ); parameter_types! { pub const BlockHashCount: u64 = 250; pub const SS58Prefix: u8 = 42; } impl system::Config for Test { type AccountData = (); type AccountId = u64; type BaseCallFilter = Everything; type Block = Block; type BlockHashCount = BlockHashCount; type BlockLength = (); type BlockWeights = (); type DbWeight = (); type Hash = H256; type Hashing = BlakeTwo256; type Lookup = IdentityLookup; type MaxConsumers = frame_support::traits::ConstU32<16>; type Nonce = u64; type OnKilledAccount = (); type OnNewAccount = (); type OnSetCode = (); type PalletInfo = PalletInfo; type RuntimeCall = RuntimeCall; type RuntimeEvent = RuntimeEvent; type RuntimeOrigin = RuntimeOrigin; type SS58Prefix = SS58Prefix; type SystemWeightInfo = (); type Version = (); } impl crate::Config for Test { type RuntimeEvent = RuntimeEvent; } // Build genesis storage according to the mock runtime. pub fn new_test_ext() -> sp_io::TestExternalities { system::GenesisConfig::::default().build_storage().unwrap().into() }