Trying to create a mock environment for testing a pallet, but getting an error msg failed to resolve: could not find
tt_error_token in the crate root
whenever trying to add my pallet in the mock environment.
1 Answer
I'd suggest to take this pallet as a template for yours. Is a pallet template from the Substrate Developer Hub repo.
In this you can see how to mock the environment:
frame_support::construct_runtime!(
pub enum Test where
Block = Block,
NodeBlock = Block,
UncheckedExtrinsic = UncheckedExtrinsic,
{
System: frame_system,
TemplateModule: pallet_template,
}
);
Adding the pallet_template:
impl pallet_template::Config for Test {
type RuntimeEvent = RuntimeEvent;
}
And how to create the unit tests.
Configs
before adding it toconstruct_runtime
?