Skip to content

Commit

Permalink
chore: Rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-l committed Apr 8, 2024
1 parent 886cbfc commit ac4391c
Showing 1 changed file with 19 additions and 27 deletions.
46 changes: 19 additions & 27 deletions crates/rpc/tests/rpc.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
// These tests need Beerus to run in the background, hence why they're hidden behing the following feature.
#![cfg(feature = "integration-tests")]

use tokio_retry::Retry;
use std::{format, sync::Once};
use beerus_core::{
config::Config,
client::BeerusClient,
};
use beerus_core::{client::BeerusClient, config::Config};
use beerus_rpc::BeerusRpc;
use reqwest::Url;
use starknet::{
core::types::{
BlockHashAndNumber, BlockId, BlockTag, BlockWithTxHashes, BlockWithTxs,
DeclareTransaction, DeployAccountTransaction, Event, EventFilter,
FieldElement, InvokeTransaction,
MaybePendingBlockWithTxHashes, MaybePendingBlockWithTxs,
MaybePendingTransactionReceipt,
Transaction, TransactionReceipt,
FieldElement, InvokeTransaction, MaybePendingBlockWithTxHashes,
MaybePendingBlockWithTxs, MaybePendingTransactionReceipt, Transaction,
TransactionReceipt,
},
providers::{
jsonrpc::HttpTransport, JsonRpcClient, Provider, ProviderError,
},
};
use std::{format, sync::Once};
use tokio_retry::Retry;

struct TestContext<T> {
client: JsonRpcClient<HttpTransport>,
Expand Down Expand Up @@ -161,7 +157,6 @@ impl L2ClientExt for JsonRpcClient<HttpTransport> {
}
}


#[tokio::test]
async fn test_block_number() {
let TestContext { client, block, block_id: _, extracted_value: () } =
Expand Down Expand Up @@ -237,8 +232,8 @@ async fn test_get_block_with_tx_hashes() {
async fn test_get_class() {
let TestContext { client, block: _, block_id, extracted_value } =
context(|block| {
block.transactions.iter().find_map(|transaction| {
match transaction {
block.transactions.iter().find_map(
|transaction| match transaction {
Transaction::Declare(DeclareTransaction::V0(declare)) => {
Some(declare.class_hash)
}
Expand All @@ -252,29 +247,26 @@ async fn test_get_class() {
Some(declare.class_hash)
}
_ => None,
}
})
},
)
})
.await;

client
.get_class(block_id, extracted_value)
.await
.expect("getClass failed");
client.get_class(block_id, extracted_value).await.expect("getClass failed");
}

#[tokio::test]
async fn test_get_class_at() {
let TestContext { client, block: _, block_id, extracted_value } =
context(|block| {
block.transactions.iter().find_map(|transaction| {
match transaction {
block.transactions.iter().find_map(
|transaction| match transaction {
Transaction::DeployAccount(
DeployAccountTransaction::V3(deploy),
) => Some(deploy.transaction_hash),
_ => None,
}
})
},
)
})
.await;
let deploy_tx_hash = extracted_value;
Expand All @@ -301,14 +293,14 @@ async fn test_get_class_at() {
async fn test_get_class_hash_at() {
let TestContext { client, block: _, block_id, extracted_value } =
context(|block| {
block.transactions.iter().find_map(|transaction| {
match transaction {
block.transactions.iter().find_map(
|transaction| match transaction {
Transaction::DeployAccount(
DeployAccountTransaction::V3(deploy),
) => Some(deploy.transaction_hash),
_ => None,
}
})
},
)
})
.await;
let deploy_tx_hash = extracted_value;
Expand Down

0 comments on commit ac4391c

Please sign in to comment.