Skip to content

Commit

Permalink
chore: fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
devanoneth committed Nov 24, 2023
1 parent e24d3f4 commit c51d065
Showing 1 changed file with 25 additions and 31 deletions.
56 changes: 25 additions & 31 deletions tests/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,37 +371,31 @@ async fn post_simulate_no_data() {

#[tokio::test(flavor = "multi_thread")]
async fn post_simulate_incorrect_chain_id() {
temp_env::async_with_vars(
[(
"FORK_URL",
Some("https://eth.llamarpc.com"),
)],
async {
let filter = filter();

let json = serde_json::json!({
"chainId": 137,
"from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"to": "0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5",
"gasLimit": 21000,
"value": "100000",
"blockNumber": 16784600
});

let res = warp::test::request()
.method("POST")
.path("/simulate")
.json(&json)
.reply(&filter)
.await;

assert_eq!(res.status(), 400);

let body: ErrorMessage = serde_json::from_slice(res.body()).unwrap();

assert_eq!(body.message, "INCORRECT_CHAIN_ID".to_string());
},
)
temp_env::async_with_vars([("FORK_URL", Some("https://eth.llamarpc.com"))], async {
let filter = filter();

let json = serde_json::json!({
"chainId": 137,
"from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"to": "0x95222290dd7278aa3ddd389cc1e1d165cc4bafe5",
"gasLimit": 21000,
"value": "100000",
"blockNumber": 16784600
});

let res = warp::test::request()
.method("POST")
.path("/simulate")
.json(&json)
.reply(&filter)
.await;

assert_eq!(res.status(), 400);

let body: ErrorMessage = serde_json::from_slice(res.body()).unwrap();

assert_eq!(body.message, "INCORRECT_CHAIN_ID".to_string());
})
.await;
}

Expand Down

0 comments on commit c51d065

Please sign in to comment.