add missing import and test more
This commit is contained in:
parent
af45f78ff5
commit
205a5b9b42
@ -67,6 +67,7 @@ pub struct AppConfig {
|
|||||||
|
|
||||||
/// EVM chain id. 1 for ETH
|
/// EVM chain id. 1 for ETH
|
||||||
/// TODO: better type for chain_id? max of `u64::MAX / 2 - 36` <https://github.com/ethereum/EIPs/issues/2294>
|
/// TODO: better type for chain_id? max of `u64::MAX / 2 - 36` <https://github.com/ethereum/EIPs/issues/2294>
|
||||||
|
#[serde_inline_default(1u64)]
|
||||||
pub chain_id: u64,
|
pub chain_id: u64,
|
||||||
|
|
||||||
/// Database is used for user data.
|
/// Database is used for user data.
|
||||||
@ -299,14 +300,21 @@ impl Web3RpcConfig {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::Web3RpcConfig;
|
use super::{AppConfig, Web3RpcConfig};
|
||||||
|
use serde_json::json;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn expected_app_defaults() {
|
fn expected_app_defaults() {
|
||||||
let a: AppConfig = serde_json::from_str("{}").unwrap();
|
let a: AppConfig = serde_json::from_value(json!({
|
||||||
|
"chain_id": 1,
|
||||||
|
})).unwrap();
|
||||||
|
|
||||||
|
assert_eq!(a.min_synced_rpcs, 1);
|
||||||
|
|
||||||
let b: AppConfig = Default::default();
|
let b: AppConfig = Default::default();
|
||||||
|
|
||||||
|
assert_eq!(b.min_synced_rpcs, 1);
|
||||||
|
|
||||||
assert_eq!(a, b);
|
assert_eq!(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user