Skip to content

Commit

Permalink
Fix broken unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
onyb committed Dec 26, 2024
1 parent 82d2b21 commit bc09b5b
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 18 deletions.
3 changes: 0 additions & 3 deletions components/brave_wallet/browser/blockchain_list_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -675,9 +675,6 @@ std::optional<DappListMap> ParseDappLists(const std::string& json) {
AddDappListToMap(
GetTokenListKey(mojom::CoinType::ETH, mojom::kOptimismMainnetChainId),
dapp_lists_from_component->optimism, &dapp_lists);
AddDappListToMap(
GetTokenListKey(mojom::CoinType::ETH, mojom::kAuroraMainnetChainId),
dapp_lists_from_component->aurora, &dapp_lists);
AddDappListToMap(
GetTokenListKey(mojom::CoinType::ETH, mojom::kAvalancheMainnetChainId),
dapp_lists_from_component->avalanche, &dapp_lists);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,9 @@ TEST(BlockchainListParseUnitTest, ParseDappLists) {
std::optional<DappListMap> dapp_list_map = ParseDappLists(dapp_list);
ASSERT_TRUE(dapp_list_map);

// There should be eight lists, for Ethereum, Solana, Polygon, Binance Smart
// Chain, Optimism, Aurora, Avalanche, and Fantom
ASSERT_EQ(8u, dapp_list_map->size());
// There should be seven lists, for Ethereum, Solana, Polygon, Binance Smart
// Chain, Optimism, Avalanche, and Fantom
ASSERT_EQ(7u, dapp_list_map->size());

// There should be one dapp in the Ethereum list
auto it = dapp_list_map->find(
Expand Down
6 changes: 3 additions & 3 deletions components/brave_wallet/browser/brave_wallet_p3a_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -601,14 +601,14 @@ TEST_F(BraveWalletP3AUnitTest, EthTransactionSentObservation) {
std::string tx_meta_id;
EXPECT_TRUE(AddUnapprovedEvmTransaction(
mojom::NewEvmTransactionParams::New(
mojom::kAuroraMainnetChainId, eth_from(),
mojom::kBnbSmartChainMainnetChainId, eth_from(),
"0xbe862ad9abfe6f22bcb087716c7d89a26051f74c", "0x016345785d8a0000",
"0x0974", std::vector<uint8_t>()),
&tx_meta_id));

// Approve the ETH transaction
EXPECT_TRUE(ApproveTransaction(mojom::CoinType::ETH,
mojom::kAuroraMainnetChainId, tx_meta_id));
EXPECT_TRUE(ApproveTransaction(
mojom::CoinType::ETH, mojom::kBnbSmartChainMainnetChainId, tx_meta_id));

// Verify EthTransactionSent
histogram_tester_->ExpectUniqueSample(kEthTransactionSentHistogramName, 1, 1);
Expand Down
2 changes: 1 addition & 1 deletion components/brave_wallet/browser/eth_tx_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ TEST_F(EthTxManagerUnitTest, AddUnapprovedEvmTransaction) {
// Known non-Eip1559 chain.
{
auto params = mojom::NewEvmTransactionParams::New(
mojom::kAuroraMainnetChainId, from(),
mojom::kBnbSmartChainMainnetChainId, from(),
"0xbe862ad9abfe6f22bcb087716c7d89a26051f74c", "0x016345785d8a0000",
"0x0974", data_);
EXPECT_FALSE(*network_manager_->IsEip1559Chain(params->chain_id));
Expand Down
2 changes: 1 addition & 1 deletion components/brave_wallet/browser/network_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ std::optional<bool> GetEip1559ForKnownChain(std::string_view chain_id_lwr) {
{mojom::kFilecoinEthereumMainnetChainId, true},
{mojom::kFilecoinEthereumTestnetChainId, true},
{mojom::kBnbSmartChainMainnetChainId, false},
{mojom::kAuroraMainnetChainId, false},
{mojom::kBaseMainnetChainId, true},
{mojom::kNeonEVMMainnetChainId, false},
{mojom::kLocalhostChainId, false},
});
Expand Down
8 changes: 1 addition & 7 deletions components/brave_wallet/browser/network_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -472,12 +472,6 @@ TEST_F(NetworkManagerUnitTest, GetZCashSubdomainForKnownChainId) {
}

TEST_F(NetworkManagerUnitTest, GetKnownChain) {
const base::flat_set<std::string> non_eip1559_networks = {
brave_wallet::mojom::kLocalhostChainId,
brave_wallet::mojom::kBnbSmartChainMainnetChainId,
brave_wallet::mojom::kAuroraMainnetChainId,
brave_wallet::mojom::kNeonEVMMainnetChainId};

auto known_chains = NetworkManager::GetAllKnownChains(mojom::CoinType::ETH);
ASSERT_FALSE(known_chains.empty());
for (const auto& chain : known_chains) {
Expand Down Expand Up @@ -654,7 +648,7 @@ TEST_F(NetworkManagerUnitTest, Eip1559Chain) {
{mojom::kFilecoinEthereumMainnetChainId, true},
{mojom::kFilecoinEthereumTestnetChainId, true},
{mojom::kBnbSmartChainMainnetChainId, false},
{mojom::kAuroraMainnetChainId, false},
{mojom::kBaseMainnetChainId, true},
{mojom::kNeonEVMMainnetChainId, false},
{mojom::kLocalhostChainId, false}};
for (auto& [chain_id, value] : known_states) {
Expand Down

0 comments on commit bc09b5b

Please sign in to comment.