Skip to content

Commit

Permalink
chore(l1_provider): reduce test boilerplate (#2167)
Browse files Browse the repository at this point in the history
Co-Authored-By: Gilad Chase <[email protected]>
  • Loading branch information
giladchase and Gilad Chase authored Nov 19, 2024
1 parent 27a4c29 commit 66bd6f0
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions crates/starknet_l1_provider/src/l1_provider_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ use starknet_api::test_utils::l1_handler::executable_l1_handler_tx;
use starknet_api::transaction::TransactionHash;

use crate::errors::L1ProviderError;
use crate::{L1Provider, ProviderState, TransactionManager};
use crate::ProviderState::{Propose, Validate};
use crate::{L1Provider, TransactionManager};

macro_rules! tx {
(tx_hash: $tx_hash:expr) => {{
Expand Down Expand Up @@ -73,17 +74,11 @@ fn proposal_start_errors() {

assert_matches!(
l1_provider.proposal_start().unwrap_err(),
L1ProviderError::UnexpectedProviderStateTransition {
from: ProviderState::Propose,
to: ProviderState::Propose
}
L1ProviderError::UnexpectedProviderStateTransition { from: Propose, to: Propose }
);
assert_matches!(
l1_provider.validation_start().unwrap_err(),
L1ProviderError::UnexpectedProviderStateTransition {
from: ProviderState::Propose,
to: ProviderState::Validate
}
L1ProviderError::UnexpectedProviderStateTransition { from: Propose, to: Validate }
);
}

Expand All @@ -97,16 +92,10 @@ fn validation_start_errors() {

assert_matches!(
l1_provider.validation_start().unwrap_err(),
L1ProviderError::UnexpectedProviderStateTransition {
from: ProviderState::Validate,
to: ProviderState::Validate
}
L1ProviderError::UnexpectedProviderStateTransition { from: Validate, to: Validate }
);
assert_matches!(
l1_provider.proposal_start().unwrap_err(),
L1ProviderError::UnexpectedProviderStateTransition {
from: ProviderState::Validate,
to: ProviderState::Propose
}
L1ProviderError::UnexpectedProviderStateTransition { from: Validate, to: Propose }
);
}

0 comments on commit 66bd6f0

Please sign in to comment.