Skip to content

Commit

Permalink
Address test code warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ligustah committed May 7, 2024
1 parent 7088ed7 commit 3da5ce2
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ pub fn init() -> Config {

#[cfg(test)]
mod test {
use crate::config::{BootNodes, ChainInclusionMode, Config};
use crate::config::{BootNodes, Config};
use std::env;
use std::str::FromStr;

Expand Down
8 changes: 5 additions & 3 deletions src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ impl<T: Reader> RuleContext<T> {
}
}

#[cfg(test)]
use crate::storage::PremintStorage;

#[cfg(test)]
impl RuleContext<PremintStorage> {
pub async fn test_default() -> Self {
Expand Down Expand Up @@ -482,8 +485,8 @@ mod test {
}

async fn simple_rule<T: Reader>(
item: &PremintTypes,
context: &RuleContext<T>,
_item: &PremintTypes,
_context: &RuleContext<T>,
) -> eyre::Result<Evaluation> {
Ok(Accept)
}
Expand Down Expand Up @@ -546,7 +549,6 @@ mod test {
#[tokio::test]
async fn test_typed_rules_engine() {
let (mut engine, storage) = test_rules_engine().await;
let context = RuleContext::test_default().await;

let rule: Box<dyn Rule<PremintStorage>> =
typed_rule!(PremintTypes::Simple, simple_typed_rule);
Expand Down
2 changes: 1 addition & 1 deletion src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ mod test {
use crate::storage::{
list_all, list_all_with_options, PremintStorage, QueryOptions, Reader, Writer,
};
use crate::types::{InclusionClaim, Premint, PremintTypes};
use crate::types::{InclusionClaim, PremintTypes};

#[tokio::test]
async fn test_insert_and_get() {
Expand Down
2 changes: 1 addition & 1 deletion tests/common/factories.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy::primitives::{Address, U256};
use alloy::primitives::Address;
use mintpool::types::SimplePremint;
use rand::{Rng, RngCore};

Expand Down
4 changes: 4 additions & 0 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
pub mod factories;

#[allow(dead_code)]
pub mod mintpool_build {
use mintpool::config::Config;
use mintpool::controller::{ControllerCommands, ControllerInterface};
Expand Down Expand Up @@ -105,6 +107,7 @@ pub mod mintpool_build {
}
}

#[allow(dead_code)]
pub mod helpers {
use mintpool::controller::ControllerCommands;
use mintpool::types::PremintTypes;
Expand All @@ -126,6 +129,7 @@ pub mod helpers {
}
}

#[allow(dead_code)]
pub mod asserts {
pub async fn expect_n_connections(ctl: &mintpool::controller::ControllerInterface, n: usize) {
let state = ctl
Expand Down
4 changes: 1 addition & 3 deletions tests/e2e_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use alloy::signers::wallet::LocalWallet;
use alloy::signers::Signer;
use alloy::sol_types::{SolCall, SolValue};
use alloy::transports::{RpcError, TransportErrorKind};
use mintpool::config::{BootNodes, ChainInclusionMode, Config};
use mintpool::config::{ChainInclusionMode, Config};
use mintpool::controller::{ControllerCommands, DBQuery};
use mintpool::premints::zora_premint::contract::IZoraPremintV2::MintArguments;
use mintpool::premints::zora_premint::contract::{IZoraPremintV2, PREMINT_FACTORY_ADDR};
Expand All @@ -23,8 +23,6 @@ use mintpool::rules::RulesEngine;
use mintpool::run;
use mintpool::types::PremintTypes;
use std::env;
use std::fmt::Debug;
use std::str::FromStr;
use std::time::Duration;

/// This test does the full round trip lifecycle of a premint
Expand Down
4 changes: 2 additions & 2 deletions tests/p2p_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ async fn test_list_all_premints() {

let nodes = mintpool_build::gen_fully_connected_swarm(2310, num_nodes).await;
let (first, nodes) = mintpool_build::split_first_rest(nodes).await;
let (snd, rcv) = tokio::sync::oneshot::channel();
let (snd, _rcv) = tokio::sync::oneshot::channel();
first
.send_command(Broadcast {
message: PremintTypes::ZoraV2(Default::default()),
channel: snd,
})
.await
.unwrap();
let (snd, rcv) = tokio::sync::oneshot::channel();
let (snd, _rcv) = tokio::sync::oneshot::channel();

first
.send_command(Broadcast {
Expand Down

0 comments on commit 3da5ce2

Please sign in to comment.