From 09712b68f69d10fbb46e667da5a7a97b0f68e9be Mon Sep 17 00:00:00 2001 From: Itay Tsabary Date: Wed, 5 Jun 2024 12:58:32 +0300 Subject: [PATCH] chore: separate mempool infra test utils from test commit-id:678cdaac --- crates/mempool_infra/tests/common/mod.rs | 14 ++++++++++++++ .../tests/component_server_client_test.rs | 10 ++-------- 2 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 crates/mempool_infra/tests/common/mod.rs diff --git a/crates/mempool_infra/tests/common/mod.rs b/crates/mempool_infra/tests/common/mod.rs new file mode 100644 index 00000000..442cde9e --- /dev/null +++ b/crates/mempool_infra/tests/common/mod.rs @@ -0,0 +1,14 @@ +use async_trait::async_trait; + +type ValueA = u32; +type ValueB = u8; + +#[async_trait] +pub(crate) trait ComponentATrait: Send + Sync { + async fn a_get_value(&self) -> ValueA; +} + +#[async_trait] +pub(crate) trait ComponentBTrait: Send + Sync { + async fn b_get_value(&self) -> ValueB; +} diff --git a/crates/mempool_infra/tests/component_server_client_test.rs b/crates/mempool_infra/tests/component_server_client_test.rs index 3e0c7c59..ce42aea6 100644 --- a/crates/mempool_infra/tests/component_server_client_test.rs +++ b/crates/mempool_infra/tests/component_server_client_test.rs @@ -10,15 +10,9 @@ use tokio::task; type ValueA = u32; type ValueB = u8; -#[async_trait] -trait ComponentATrait: Send + Sync { - async fn a_get_value(&self) -> ValueA; -} +mod common; -#[async_trait] -trait ComponentBTrait: Send + Sync { - async fn b_get_value(&self) -> ValueB; -} +use common::{ComponentATrait, ComponentBTrait}; struct ComponentA { b: Box,