Skip to content

Commit

Permalink
fix: support custom accounts in constructor (#460)
Browse files Browse the repository at this point in the history
Due to #454, IntegrationTestSetup now accepts any array of contracts,
which are then passed on to the state reader for initialization.

Co-Authored-By: Gilad Chase <[email protected]>
  • Loading branch information
giladchase and Gilad Chase authored Jul 15, 2024
1 parent a9df361 commit 0cff9b3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/tests-integration/src/integration_test_utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::net::SocketAddr;

use axum::body::Body;
use blockifier::test_utils::contracts::FeatureContract;
use mempool_test_utils::starknet_api_test_utils::{
external_tx_to_json, MultiAccountTransactionGenerator,
};
Expand Down Expand Up @@ -108,10 +109,12 @@ pub async fn get_available_socket() -> SocketAddr {

/// Use to create a tx generator with _pre-funded_ accounts, alongside a mocked test setup.
pub async fn setup_with_tx_generation(
n_accounts: usize,
accounts: &[FeatureContract],
) -> (IntegrationTestSetup, MultiAccountTransactionGenerator) {
let integration_test_setup = IntegrationTestSetup::new(n_accounts).await;
let tx_generator = MultiAccountTransactionGenerator::new(n_accounts);
let integration_test_setup =
IntegrationTestSetup::new_for_account_contracts(accounts.iter().copied()).await;
let tx_generator =
MultiAccountTransactionGenerator::new_for_account_contracts(accounts.iter().copied());

(integration_test_setup, tx_generator)
}

0 comments on commit 0cff9b3

Please sign in to comment.