Skip to content

Commit

Permalink
Fix AccountTx test
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronek committed Oct 23, 2023
1 parent 0467971 commit b8b2813
Showing 1 changed file with 31 additions and 16 deletions.
47 changes: 31 additions & 16 deletions src/test/rpc/AccountTx_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,22 +120,37 @@ class AccountTx_test : public beast::unit_test::suite
// All other ledgers have no txs

auto hasTxs = [apiVersion](Json::Value const& j) {
return j.isMember(jss::result) &&
(j[jss::result][jss::status] == "success") &&
(j[jss::result][jss::transactions].size() == 2) &&
(j[jss::result][jss::transactions][0u][jss::tx]
[jss::TransactionType] == jss::AccountSet) &&
(j[jss::result][jss::transactions][1u][jss::tx]
[jss::TransactionType] == jss::Payment) &&
(j[jss::result][jss::transactions][1u][jss::tx]
[jss::DeliverMax] == "10000000010") &&
((apiVersion > 1 &&
!j[jss::result][jss::transactions][1u][jss::tx].isMember(
jss::Amount)) ||
(apiVersion <= 1 &&
j[jss::result][jss::transactions][1u][jss::tx][jss::Amount] ==
j[jss::result][jss::transactions][1u][jss::tx]
[jss::DeliverMax]));
switch (apiVersion)
{
case 1:
return j.isMember(jss::result) &&
(j[jss::result][jss::status] == "success") &&
(j[jss::result][jss::transactions].size() == 2) &&
(j[jss::result][jss::transactions][0u][jss::tx]
[jss::TransactionType] == jss::AccountSet) &&
(j[jss::result][jss::transactions][1u][jss::tx]
[jss::TransactionType] == jss::Payment) &&
(j[jss::result][jss::transactions][1u][jss::tx]
[jss::DeliverMax] == "10000000010") &&
(j[jss::result][jss::transactions][1u][jss::tx]
[jss::Amount] ==
j[jss::result][jss::transactions][1u][jss::tx]
[jss::DeliverMax]);
case 2:
return j.isMember(jss::result) &&
(j[jss::result][jss::status] == "success") &&
(j[jss::result][jss::transactions].size() == 2) &&
(j[jss::result][jss::transactions][0u][jss::tx_json]
[jss::TransactionType] == jss::AccountSet) &&
(j[jss::result][jss::transactions][1u][jss::tx_json]
[jss::TransactionType] == jss::Payment) &&
(j[jss::result][jss::transactions][1u][jss::tx_json]
[jss::DeliverMax] == "10000000010") &&
(!j[jss::result][jss::transactions][1u][jss::tx_json]
.isMember(jss::Amount));
default:
return false;
}
};

auto noTxs = [](Json::Value const& j) {
Expand Down

0 comments on commit b8b2813

Please sign in to comment.