fix remaining tests

pull/2834/head
Ayrat Badykov 5 years ago
parent a2fc77c6dc
commit 1da1893075
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 18
      apps/block_scout_web/test/block_scout_web/controllers/address_internal_transaction_controller_test.exs
  2. 2
      apps/block_scout_web/test/block_scout_web/controllers/address_token_balance_controller_test.exs
  3. 2
      apps/block_scout_web/test/block_scout_web/controllers/smart_contract_controller_test.exs
  4. 2
      apps/block_scout_web/test/block_scout_web/features/pages/address_page.ex
  5. 2
      apps/explorer/test/support/factory.ex

@ -104,7 +104,12 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do
transaction_index: transaction.index transaction_index: transaction.index
) )
path = address_internal_transaction_path(conn, :index, address, %{"filter" => "from", "type" => "JSON"}) path =
address_internal_transaction_path(conn, :index, Address.checksum(address), %{
"filter" => "from",
"type" => "JSON"
})
conn = get(conn, path) conn = get(conn, path)
internal_transaction_tiles = json_response(conn, 200)["items"] internal_transaction_tiles = json_response(conn, 200)["items"]
@ -282,7 +287,7 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do
) )
conn = conn =
get(conn, address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash), %{ get(conn, address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash)), %{
"block_number" => Integer.to_string(b_block.number), "block_number" => Integer.to_string(b_block.number),
"transaction_index" => Integer.to_string(transaction_3.index), "transaction_index" => Integer.to_string(transaction_3.index),
"index" => Integer.to_string(index), "index" => Integer.to_string(index),
@ -322,10 +327,15 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do
end) end)
conn = conn =
get(conn, address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash, %{"type" => "JSON"})) get(
conn,
address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash), %{
"type" => "JSON"
})
)
expected_response = expected_response =
address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash), %{ address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash, %{
"block_number" => number, "block_number" => number,
"index" => 11, "index" => 11,
"transaction_index" => transaction_index "transaction_index" => transaction_index

@ -8,7 +8,7 @@ defmodule BlockScoutWeb.AddressTokenBalanceControllerTest do
test "without AJAX", %{conn: conn} do test "without AJAX", %{conn: conn} do
%Address{hash: hash} = Factory.insert(:address) %Address{hash: hash} = Factory.insert(:address)
response_conn = get(conn, address_token_balance_path(conn, :index, to_string(hash))) response_conn = get(conn, address_token_balance_path(conn, :index, Address.checksum(hash)))
assert html_response(response_conn, 404) assert html_response(response_conn, 404)
end end

@ -107,7 +107,7 @@ defmodule BlockScoutWeb.SmartContractControllerTest do
smart_contract_path( smart_contract_path(
BlockScoutWeb.Endpoint, BlockScoutWeb.Endpoint,
:show, :show,
smart_contract.address_hash, Address.checksum(smart_contract.address_hash),
function_name: "get", function_name: "get",
args: [] args: []
) )

@ -166,7 +166,7 @@ defmodule BlockScoutWeb.AddressPage do
css("[data-identifier-hash='#{transaction_hash}'] [data-test='token_transfers_expansion']") css("[data-identifier-hash='#{transaction_hash}'] [data-test='token_transfers_expansion']")
end end
def visit_page(session, %Address{hash: address_hash}), do: visit_page(session, address_hash) def visit_page(session, %Address{hash: address_hash}), do: visit_page(session, Address.checksum(address_hash))
def visit_page(session, address_hash) do def visit_page(session, address_hash) do
visit(session, "/address/#{Address.checksum(address_hash)}") visit(session, "/address/#{Address.checksum(address_hash)}")

@ -72,7 +72,7 @@ defmodule Explorer.Factory do
def contract_address_factory do def contract_address_factory do
%Address{ %Address{
hash: Address.checksum(address_hash()), hash: address_hash(),
contract_code: Map.fetch!(contract_code_info(), :bytecode) contract_code: Map.fetch!(contract_code_info(), :bytecode)
} }
end end

Loading…
Cancel
Save