Skip to content

Commit

Permalink
remove anyhow in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zvolin committed Dec 11, 2024
1 parent e83598d commit 5cebaf8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 15 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

3 changes: 0 additions & 3 deletions grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ tonic = { version = "0.12.3", default-features = false, features = [ "transport"
getrandom = { version = "0.2.15", features = ["js"] }
tonic-web-wasm-client = "0.6"

[dev-dependencies]
anyhow = "1.0.86"

[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
dotenvy = "0.15.7"
tokio = { version = "1.38.0", features = ["rt", "macros"] }
Expand Down
12 changes: 6 additions & 6 deletions grpc/tests/tonic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

#[async_test]
async fn get_min_gas_price() {
let mut client = new_test_client().unwrap();
let mut client = new_test_client();
let gas_price = client.get_min_gas_price().await.unwrap();
assert!(gas_price > 0.0);
}

#[async_test]
async fn get_blob_params() {
let mut client = new_test_client().unwrap();
let mut client = new_test_client();
let params = client.get_blob_params().await.unwrap();
assert!(params.gas_per_blob_byte > 0);
assert!(params.gov_max_square_size > 0);
}

#[async_test]
async fn get_auth_params() {
let mut client = new_test_client().unwrap();
let mut client = new_test_client();
let params = client.get_auth_params().await.unwrap();
assert!(params.max_memo_characters > 0);
assert!(params.tx_sig_limit > 0);
Expand All @@ -47,7 +47,7 @@ async fn get_auth_params() {

#[async_test]
async fn get_block() {
let mut client = new_test_client().unwrap();
let mut client = new_test_client();

let latest_block = client.get_latest_block().await.unwrap();
let height = latest_block.header.height.value() as i64;
Expand All @@ -58,7 +58,7 @@ async fn get_block() {

#[async_test]
async fn get_account() {
let mut client = new_test_client().unwrap();
let mut client = new_test_client();

let accounts = client.get_accounts().await.unwrap();

Expand All @@ -76,7 +76,7 @@ async fn get_account() {

#[async_test]
async fn submit_blob() {
let mut client = new_test_client().unwrap();
let mut client = new_test_client();

let account_credentials = load_account();
let namespace = Namespace::new_v0(&[1, 2, 3]).unwrap();
Expand Down
9 changes: 4 additions & 5 deletions grpc/tests/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::time::Duration;

use anyhow::Result;
use celestia_grpc::GrpcClient;
use celestia_types::state::Address;
use tendermint::crypto::default::ecdsa_secp256k1::SigningKey;
Expand All @@ -24,16 +23,16 @@ pub struct TestAccount {
}

#[cfg(not(target_arch = "wasm32"))]
pub fn new_test_client() -> Result<GrpcClient<tonic::transport::Channel>> {
pub fn new_test_client() -> GrpcClient<tonic::transport::Channel> {
let _ = dotenvy::dotenv();
let url = std::env::var("CELESTIA_GRPC_URL").unwrap_or_else(|_| CELESTIA_GRPC_URL.into());

Ok(GrpcClient::with_url(url)?)
GrpcClient::with_url(url).expect("creating client failed")
}

#[cfg(target_arch = "wasm32")]
pub fn new_test_client() -> Result<GrpcClient<tonic_web_wasm_client::Client>> {
Ok(GrpcClient::with_grpcweb_url(CELESTIA_GRPCWEB_PROXY_URL))
pub fn new_test_client() -> GrpcClient<tonic_web_wasm_client::Client> {
GrpcClient::with_grpcweb_url(CELESTIA_GRPCWEB_PROXY_URL)
}

pub fn load_account() -> TestAccount {
Expand Down

0 comments on commit 5cebaf8

Please sign in to comment.