Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
  • Loading branch information
antiyro committed Jun 17, 2024
1 parent a9d3669 commit bfd11f9
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions unit_tests/tests/test_get_state_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ async fn work_loop_existing_block(clients: HashMap<String, JsonRpcClient<HttpTra

#[rstest]
#[tokio::test]
#[ignore = "Pending data is not supported yet"]
async fn work_block_pending(clients: HashMap<String, JsonRpcClient<HttpTransport>>) {
let deoxys = &clients[DEOXYS];
let pathfinder = &clients[PATHFINDER];
Expand Down Expand Up @@ -193,3 +194,34 @@ async fn work_block_pending(clients: HashMap<String, JsonRpcClient<HttpTransport
assert_eq!(sorted_deoxys, sorted_juno, "The sorted responses do not match");
assert_eq!(sorted_juno, sorted_pathfinder, "The sorted responses do not match");
}

#[rstest]
#[tokio::test]
async fn work_block_latest(clients: HashMap<String, JsonRpcClient<HttpTransport>>) {
let deoxys = &clients[DEOXYS];
let pathfinder = &clients[PATHFINDER];
let juno = &clients[JUNO];

let block_number = BlockId::Tag(BlockTag::Latest);
let response_deoxys = deoxys
.get_state_update(block_number)
.await
.expect("Deoxys : Error while getting the state update");
let response_pathfinder = pathfinder
.get_state_update(block_number)
.await
.expect("RPC : Error while getting the state update");
let response_juno = juno
.get_state_update(block_number)
.await
.expect("RPC : Error while getting the state update");

// Extract and sort the updates
let sorted_deoxys = extract_and_sort_state_update(response_deoxys);
let sorted_pathfinder = extract_and_sort_state_update(response_pathfinder);
let sorted_juno = extract_and_sort_state_update(response_juno);

assert_eq!(sorted_deoxys, sorted_pathfinder, "The sorted responses do not match");
assert_eq!(sorted_deoxys, sorted_juno, "The sorted responses do not match");
assert_eq!(sorted_juno, sorted_pathfinder, "The sorted responses do not match");
}

0 comments on commit bfd11f9

Please sign in to comment.