Skip to content

Commit

Permalink
Mock builder update. Improved FI coverage (#1945)
Browse files Browse the repository at this point in the history
* fix issues with default_features

* check if hooks are called for FI

* correct foss3 dependency

* cargo update

* fix dep chagne

* fix features

* revert procedural crate version
  • Loading branch information
lemunozm authored Aug 5, 2024
1 parent fc2b451 commit 8245ce2
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 78 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

14 changes: 7 additions & 7 deletions libs/mocks/src/foreign_investment_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pub mod pallet {
use cfg_traits::investments::ForeignInvestmentHooks;
use frame_support::pallet_prelude::*;
use mock_builder::{execute_call, register_call};
use mock_builder::{execute_call, register_call, CallHandler};

#[pallet::config]
pub trait Config: frame_system::Config {
Expand All @@ -28,8 +28,8 @@ pub mod pallet {
T::Amount,
) -> DispatchResult
+ 'static,
) {
register_call!(move |(a, b, c, d, e)| f(a, b, c, d, e));
) -> CallHandler {
register_call!(move |(a, b, c, d, e)| f(a, b, c, d, e))
}

pub fn mock_fulfill_collect_investment(
Expand All @@ -41,8 +41,8 @@ pub mod pallet {
T::TrancheAmount,
) -> DispatchResult
+ 'static,
) {
register_call!(move |(a, b, c, d, e)| f(a, b, c, d, e));
) -> CallHandler {
register_call!(move |(a, b, c, d, e)| f(a, b, c, d, e))
}

pub fn mock_fulfill_collect_redemption(
Expand All @@ -54,8 +54,8 @@ pub mod pallet {
T::Amount,
) -> DispatchResult
+ 'static,
) {
register_call!(move |(a, b, c, d, e)| f(a, b, c, d, e));
) -> CallHandler {
register_call!(move |(a, b, c, d, e)| f(a, b, c, d, e))
}
}

Expand Down
2 changes: 1 addition & 1 deletion libs/mocks/src/token_swaps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub mod pallet {
pub fn mock_fill_order(
f: impl Fn(T::AccountId, T::OrderId, T::BalanceOut) -> DispatchResult + 'static,
) {
register_call!(move |(a, b, c)| f(a, b, c))
register_call!(move |(a, b, c)| f(a, b, c));
}
}

Expand Down
9 changes: 6 additions & 3 deletions libs/traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ sp-std = { workspace = true }
strum = { workspace = true }

[dev-dependencies]
cfg-mocks = { workspace = true, default_features = true }
frame-system = { workspace = true, default_features = true }
mock-builder = { workspace = true, default_features = true }
cfg-mocks = { workspace = true, default-features = true }
frame-system = { workspace = true, default-features = true }
mock-builder = { workspace = true, default-features = true }

[features]
default = ["std"]
Expand All @@ -45,11 +45,14 @@ std = [
runtime-benchmarks = [
"cfg-primitives/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"cfg-mocks/runtime-benchmarks",
]
try-runtime = [
"frame-support/try-runtime",
"frame-system/try-runtime",
"cfg-primitives/try-runtime",
"sp-runtime/try-runtime",
"cfg-mocks/try-runtime",
]
Loading

0 comments on commit 8245ce2

Please sign in to comment.