Skip to content

Commit

Permalink
test(logic): add new mock with handler for logic querier
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeneux authored and amimart committed Mar 23, 2023
1 parent 674b6e1 commit 61ce268
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/logic-bindings/src/testing/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<LH: 'static>(handler: LH) -> OwnedDeps<MockStorage, MockApi, MockQuerier<LogicCustomQuery>, 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.
Expand Down

0 comments on commit 61ce268

Please sign in to comment.