-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7247758
commit 951e57a
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
pub mod common; | ||
|
||
mod get_block_txs_count_tests { | ||
|
||
use starknet_rs_core::types::{BlockId, BlockTag, StarknetError}; | ||
use starknet_rs_providers::{Provider, ProviderError}; | ||
|
||
use crate::common::background_devnet::BackgroundDevnet; | ||
|
||
#[tokio::test] | ||
async fn test_invalid_block() { | ||
let devnet = BackgroundDevnet::spawn().await.expect("Could not start Devnet"); | ||
|
||
let res = devnet | ||
.json_rpc_client | ||
.get_block_transaction_count(BlockId::Number(9000000000)) | ||
.await | ||
.unwrap_err(); | ||
match res { | ||
ProviderError::StarknetError(StarknetError::BlockNotFound) => (), | ||
_ => panic!("Invalid error: {res:?}"), | ||
} | ||
} | ||
|
||
#[tokio::test] | ||
async fn test_valid_block() { | ||
let devnet = BackgroundDevnet::spawn().await.expect("Could not start Devnet"); | ||
|
||
devnet | ||
.json_rpc_client | ||
.get_block_transaction_count(BlockId::Tag(BlockTag::Latest)) | ||
.await | ||
.unwrap(); | ||
} | ||
} |