Skip to content

Commit

Permalink
chore: add another module parser test (#5496)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Nov 20, 2023
1 parent 3c7989c commit 39a2dc6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bin/reth/src/args/rpc_server_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,23 @@ mod tests {
assert_eq!(apis, expected);
}

#[test]
fn test_rpc_server_eth_call_bundle_args() {
let args = CommandParser::<RpcServerArgs>::parse_from([
"reth",
"--http.api",
"eth,admin,debug,eth-call-bundle",
])
.args;

let apis = args.http_api.unwrap();
let expected =
RpcModuleSelection::try_from_selection(["eth", "admin", "debug", "eth-call-bundle"])
.unwrap();

assert_eq!(apis, expected);
}

#[test]
fn test_rpc_server_args_parser_none() {
let args = CommandParser::<RpcServerArgs>::parse_from(["reth", "--http.api", "none"]).args;
Expand Down
14 changes: 14 additions & 0 deletions crates/rpc/rpc-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2081,6 +2081,20 @@ mod tests {
assert_eq!(selection, RethRpcModule::EthCallBundle);
}

#[test]
fn parse_eth_call_bundle_selection() {
let selection = "eth,admin,debug,eth-call-bundle".parse::<RpcModuleSelection>().unwrap();
assert_eq!(
selection,
RpcModuleSelection::Selection(vec![
RethRpcModule::Eth,
RethRpcModule::Admin,
RethRpcModule::Debug,
RethRpcModule::EthCallBundle,
])
);
}

#[test]
fn parse_rpc_module_selection() {
let selection = "all".parse::<RpcModuleSelection>().unwrap();
Expand Down

0 comments on commit 39a2dc6

Please sign in to comment.