From 61ce26816970ac9bbfd959613d63cb3528d8c050 Mon Sep 17 00:00:00 2001 From: Benjamin DENEUX Date: Mon, 20 Mar 2023 11:25:18 +0100 Subject: [PATCH] test(logic): add new mock with handler for logic querier --- packages/logic-bindings/src/testing/mock.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/logic-bindings/src/testing/mock.rs b/packages/logic-bindings/src/testing/mock.rs index d38ca6d5..decc51d2 100644 --- a/packages/logic-bindings/src/testing/mock.rs +++ b/packages/logic-bindings/src/testing/mock.rs @@ -13,6 +13,17 @@ pub fn mock_dependencies_with_logic_and_balance( mock_dependencies_with_logic_and_balances(&[(MOCK_CONTRACT_ADDR, contract_balance)]) } +pub fn mock_dependencies_with_logic_handler(handler: LH) -> OwnedDeps, LogicCustomQuery> + where + LH: Fn(&LogicCustomQuery) -> QuerierResult, { + OwnedDeps { + storage: MockStorage::default(), + api: MockApi::default(), + querier: MockLogicQuerier::new(LogicQuerier::new(Box::new(handler)), &[]), + custom_query_type: PhantomData, + } +} + /// Initializes the querier along with the mock_dependencies. /// /// Set the logic querier mock handler.