Skip to content

Commit

Permalink
#1909 add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
olehnikolaiev committed Jan 10, 2025
1 parent fea97ed commit 898547b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/unittests/libweb3jsonrpc/jsonrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3699,6 +3699,25 @@ BOOST_AUTO_TEST_CASE( jsonrpcVersionInResponseHeader ) {
nlohmann::json joAnswer = nlohmann::json::parse( d.s_ );
BOOST_REQUIRE( joAnswer.count("jsonrpc") > 0 );
BOOST_REQUIRE( joAnswer["jsonrpc"] == "2.0" );

// try to send legit eth_call as well
joIn = nlohmann::json::object();
joIn["jsonrpc"] = "2.0";
joIn["method"] = "eth_call";
params = nlohmann::json::array();
callDetails = nlohmann::json::object();
callDetails["data"] = "0x2e64cec1";
callDetails["to"] = contractAddress;
callDetails["from"] = senderAddress;
callDetails["value"] = "0x0";
params.push_back(callDetails);
params.push_back("latest");
joIn["params"] = params;
d = cli.call( joIn );

joAnswer = nlohmann::json::parse( d.s_ );
BOOST_REQUIRE( joAnswer.count("jsonrpc") > 0 );
BOOST_REQUIRE( joAnswer["jsonrpc"] == "2.0" );
}

BOOST_AUTO_TEST_CASE( etherbase_generation2 ) {
Expand Down

0 comments on commit 898547b

Please sign in to comment.