Skip to content

Commit

Permalink
chore(batcher): add testing feature, use automock only as test
Browse files Browse the repository at this point in the history
commit-id:d05770a1
  • Loading branch information
Itay-Tsabary-Starkware committed Nov 19, 2024
1 parent cc2092e commit 7f1752a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

10 changes: 9 additions & 1 deletion crates/starknet_batcher_types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ edition.workspace = true
license.workspace = true
repository.workspace = true

[features]
testing = ["mockall"]

[lints]
workspace = true

[dependencies]
async-trait.workspace = true
chrono = { workspace = true, features = ["serde"] }
derive_more.workspace = true
mockall.workspace = true
mockall = { workspace = true, optional = true }
papyrus_proc_macros.workspace = true
serde = { workspace = true, features = ["derive"] }
starknet_api.workspace = true
starknet_sequencer_infra.workspace = true
thiserror.workspace = true


[dev-dependencies]
# Enable self with "testing" feature in tests.
starknet_batcher_types = { workspace = true, features = ["testing"] }
6 changes: 3 additions & 3 deletions crates/starknet_batcher_types/src/communication.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::sync::Arc;

use async_trait::async_trait;
use mockall::predicate::*;
use mockall::*;
#[cfg(any(feature = "testing", test))]
use mockall::automock;
use papyrus_proc_macros::handle_response_variants;
use serde::{Deserialize, Serialize};
use starknet_sequencer_infra::component_client::{
Expand Down Expand Up @@ -38,7 +38,7 @@ pub type SharedBatcherClient = Arc<dyn BatcherClient>;

/// Serves as the batcher's shared interface. Requires `Send + Sync` to allow transferring and
/// sharing resources (inputs, futures) across threads.
#[automock]
#[cfg_attr(any(test, feature = "testing"), automock)]
#[async_trait]
pub trait BatcherClient: Send + Sync {
/// Starts the process of building a proposal.
Expand Down

0 comments on commit 7f1752a

Please sign in to comment.