diff --git a/crates/block-explorers/src/lib.rs b/crates/block-explorers/src/lib.rs index 5e78ef5..0fc7038 100644 --- a/crates/block-explorers/src/lib.rs +++ b/crates/block-explorers/src/lib.rs @@ -581,4 +581,15 @@ mod tests { let err = Client::new_from_env(Chain::dev()).unwrap_err(); assert!(matches!(err, EtherscanError::LocalNetworksNotSupported)); } + + #[test] + fn can_parse_etherscan_mainnet_invalid_api_key() { + let err = serde_json::json!({ + "status":"0", + "message":"NOTOK", + "result":"Missing/Invalid API Key" + }); + let resp: ResponseData
= serde_json::from_value(err).unwrap(); + assert!(matches!(resp, ResponseData::Error { .. })); + } }