Skip to content

Commit

Permalink
Fix mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
F3Joule committed Feb 27, 2024
1 parent 4f1cafb commit ab8559f
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 43 deletions.
85 changes: 44 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions pallets/space-ownership/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ sp-std = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v
sp-core = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.40', default-features = false }
sp-io = { git = 'https://github.com/paritytech/substrate', branch = 'polkadot-v0.9.40', default-features = false }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.40", default-features = false }
pallet-roles = { default-features = false, path = '../../roles' }
pallet-domains = { default-features = false, path = '../../domains' }
pallet-posts = { default-features = false, path = '../../posts' }
pallet-profiles = { default-features = false, path = '../../profiles' }
pallet-roles = { default-features = false, path = '../../roles' }
pallet-spaces = { default-features = false, path = '../../spaces' }
pallet-space-follows = { default-features = false, path = '../../space-follows' }

Expand All @@ -51,8 +53,8 @@ std = [
'sp-std/std',
'pallet-permissions/std',
'pallet-balances/std',
'pallet-profiles/std',
'pallet-roles/std',
'pallet-space-follows/std',
'pallet-profiles/std',
]
try-runtime = ["frame-support/try-runtime"]
39 changes: 39 additions & 0 deletions pallets/space-ownership/tests/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,17 @@ frame_support::construct_runtime!(
SpaceFollows: pallet_space_follows,
SpaceOwnership: pallet_ownership,
Spaces: pallet_spaces,
Domains: pallet_domains,
Posts: pallet_posts,
}
);

pub(super) type AccountId = u64;
pub(super) type Balance = u64;
pub(super) type BlockNumber = u64;

pub(crate) const DOMAIN_DEPOSIT: Balance = 10;

parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const SS58Prefix: u8 = 42;
Expand Down Expand Up @@ -136,9 +140,44 @@ impl pallet_space_follows::Config for Test {
type WeightInfo = ();
}

impl pallet_posts::Config for Test {
type RuntimeEvent = RuntimeEvent;
type MaxCommentDepth = ConstU32<10>;
type IsPostBlocked = ();
type WeightInfo = ();
}

parameter_types! {
pub const BaseDomainDeposit: Balance = DOMAIN_DEPOSIT;
pub const OuterValueByteDeposit: Balance = 5;
pub const RegistrationPeriodLimit: BlockNumber = 5;
pub const InitialPaymentBeneficiary: AccountId = 1;
pub InitialPricesConfig: pallet_domains::types::PricesConfigVec<Test> = Vec::new();
}

impl pallet_domains::Config for Test {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type MinDomainLength = ConstU32<1>;
type MaxDomainLength = ConstU32<64>;
type MaxDomainsPerAccount = ConstU32<5>;
type DomainsInsertLimit = ConstU32<5>;
type RegistrationPeriodLimit = RegistrationPeriodLimit;
type MaxOuterValueLength = ConstU32<64>;
type BaseDomainDeposit = BaseDomainDeposit;
type OuterValueByteDeposit = OuterValueByteDeposit;
type InitialPaymentBeneficiary = InitialPaymentBeneficiary;
type InitialPricesConfig = InitialPricesConfig;
type WeightInfo = ();
}

impl pallet_ownership::Config for Test {
type RuntimeEvent = RuntimeEvent;
type ProfileManager = Profiles;
type SpacesInterface = Spaces;
type SpacePermissionsProvider = Spaces;
type CreatorStakingProvider = ();
type DomainsProvider = Domains;
type PostsProvider = Posts;
type WeightInfo = ();
}

0 comments on commit ab8559f

Please sign in to comment.