fix: Fix address controller flickering test (#10382)

pull/10390/head
Victor Baranov 5 months ago committed by GitHub
parent 2a00b0cd1b
commit 28a7d59c42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 32
      apps/block_scout_web/test/block_scout_web/controllers/api/v2/address_controller_test.exs

@ -71,7 +71,6 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do
"creation_tx_hash" => nil, "creation_tx_hash" => nil,
"token" => nil, "token" => nil,
"coin_balance" => nil, "coin_balance" => nil,
"exchange_rate" => nil,
# todo: added for backward compatibility, remove when frontend unbound from these props # todo: added for backward compatibility, remove when frontend unbound from these props
"implementation_address" => nil, "implementation_address" => nil,
"implementation_name" => nil, "implementation_name" => nil,
@ -89,10 +88,37 @@ defmodule BlockScoutWeb.API.V2.AddressControllerTest do
} }
request = get(conn, "/api/v2/addresses/#{Address.checksum(address.hash)}") request = get(conn, "/api/v2/addresses/#{Address.checksum(address.hash)}")
assert ^correct_response = json_response(request, 200) check_response(correct_response, json_response(request, 200))
request = get(conn, "/api/v2/addresses/#{String.downcase(to_string(address.hash))}") request = get(conn, "/api/v2/addresses/#{String.downcase(to_string(address.hash))}")
assert ^correct_response = json_response(request, 200) check_response(correct_response, json_response(request, 200))
end
defp check_response(pattern_response, response) do
assert pattern_response["hash"] == response["hash"]
assert pattern_response["is_contract"] == response["is_contract"]
assert pattern_response["is_verified"] == response["is_verified"]
assert pattern_response["name"] == response["name"]
assert pattern_response["private_tags"] == response["private_tags"]
assert pattern_response["public_tags"] == response["public_tags"]
assert pattern_response["watchlist_names"] == response["watchlist_names"]
assert pattern_response["creator_address_hash"] == response["creator_address_hash"]
assert pattern_response["creation_tx_hash"] == response["creation_tx_hash"]
assert pattern_response["token"] == response["token"]
assert pattern_response["coin_balance"] == response["coin_balance"]
assert pattern_response["implementation_address"] == response["implementation_address"]
assert pattern_response["implementation_name"] == response["implementation_name"]
assert pattern_response["implementations"] == response["implementations"]
assert pattern_response["block_number_balance_updated_at"] == response["block_number_balance_updated_at"]
assert pattern_response["has_decompiled_code"] == response["has_decompiled_code"]
assert pattern_response["has_validated_blocks"] == response["has_validated_blocks"]
assert pattern_response["has_logs"] == response["has_logs"]
assert pattern_response["has_tokens"] == response["has_tokens"]
assert pattern_response["has_token_transfers"] == response["has_token_transfers"]
assert pattern_response["watchlist_address_id"] == response["watchlist_address_id"]
assert pattern_response["has_beacon_chain_withdrawals"] == response["has_beacon_chain_withdrawals"]
assert pattern_response["ens_domain_name"] == response["ens_domain_name"]
assert pattern_response["metadata"] == response["metadata"]
end end
test "get EIP-1167 proxy contract info", %{conn: conn} do test "get EIP-1167 proxy contract info", %{conn: conn} do

Loading…
Cancel
Save