From 39a2dc6bc8d511825b1a3d69e6ae65a99c4f0be4 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 20 Nov 2023 16:03:03 +0100 Subject: [PATCH] chore: add another module parser test (#5496) --- bin/reth/src/args/rpc_server_args.rs | 17 +++++++++++++++++ crates/rpc/rpc-builder/src/lib.rs | 14 ++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/bin/reth/src/args/rpc_server_args.rs b/bin/reth/src/args/rpc_server_args.rs index 32005b163..6541797db 100644 --- a/bin/reth/src/args/rpc_server_args.rs +++ b/bin/reth/src/args/rpc_server_args.rs @@ -532,6 +532,23 @@ mod tests { assert_eq!(apis, expected); } + #[test] + fn test_rpc_server_eth_call_bundle_args() { + let args = CommandParser::::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::::parse_from(["reth", "--http.api", "none"]).args; diff --git a/crates/rpc/rpc-builder/src/lib.rs b/crates/rpc/rpc-builder/src/lib.rs index b23029b75..bd2a8db3b 100644 --- a/crates/rpc/rpc-builder/src/lib.rs +++ b/crates/rpc/rpc-builder/src/lib.rs @@ -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::().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::().unwrap();