|
|
@ -4,7 +4,7 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do |
|
|
|
import BlockScoutWeb.WebRouter.Helpers, |
|
|
|
import BlockScoutWeb.WebRouter.Helpers, |
|
|
|
only: [address_internal_transaction_path: 3, address_internal_transaction_path: 4] |
|
|
|
only: [address_internal_transaction_path: 3, address_internal_transaction_path: 4] |
|
|
|
|
|
|
|
|
|
|
|
alias Explorer.Chain.{Block, InternalTransaction, Transaction} |
|
|
|
alias Explorer.Chain.{Address, Block, InternalTransaction, Transaction} |
|
|
|
alias Explorer.ExchangeRates.Token |
|
|
|
alias Explorer.ExchangeRates.Token |
|
|
|
|
|
|
|
|
|
|
|
describe "GET index/3" do |
|
|
|
describe "GET index/3" do |
|
|
@ -17,7 +17,15 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "with valid address hash without address", %{conn: conn} do |
|
|
|
test "with valid address hash without address", %{conn: conn} do |
|
|
|
conn = get(conn, address_internal_transaction_path(conn, :index, "0x8bf38d4764929064f2d4d3a56520a76ab3df415b")) |
|
|
|
conn = |
|
|
|
|
|
|
|
get( |
|
|
|
|
|
|
|
conn, |
|
|
|
|
|
|
|
address_internal_transaction_path( |
|
|
|
|
|
|
|
conn, |
|
|
|
|
|
|
|
:index, |
|
|
|
|
|
|
|
Address.checksum("0x8bf38d4764929064f2d4d3a56520a76ab3df415b") |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
assert html_response(conn, 404) |
|
|
|
assert html_response(conn, 404) |
|
|
|
end |
|
|
|
end |
|
|
@ -25,7 +33,8 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do |
|
|
|
test "includes USD exchange rate value for address in assigns", %{conn: conn} do |
|
|
|
test "includes USD exchange rate value for address in assigns", %{conn: conn} do |
|
|
|
address = insert(:address) |
|
|
|
address = insert(:address) |
|
|
|
|
|
|
|
|
|
|
|
conn = get(conn, address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash)) |
|
|
|
conn = |
|
|
|
|
|
|
|
get(conn, address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash))) |
|
|
|
|
|
|
|
|
|
|
|
assert %Token{} = conn.assigns.exchange_rate |
|
|
|
assert %Token{} = conn.assigns.exchange_rate |
|
|
|
end |
|
|
|
end |
|
|
@ -56,7 +65,7 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do |
|
|
|
transaction_index: transaction.index |
|
|
|
transaction_index: transaction.index |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
path = address_internal_transaction_path(conn, :index, address, %{"type" => "JSON"}) |
|
|
|
path = address_internal_transaction_path(conn, :index, Address.checksum(address), %{"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"] |
|
|
@ -137,7 +146,9 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do |
|
|
|
transaction_index: transaction.index |
|
|
|
transaction_index: transaction.index |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
path = address_internal_transaction_path(conn, :index, address, %{"filter" => "to", "type" => "JSON"}) |
|
|
|
path = |
|
|
|
|
|
|
|
address_internal_transaction_path(conn, :index, Address.checksum(address), %{"filter" => "to", "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"] |
|
|
@ -312,7 +323,7 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do |
|
|
|
get(conn, address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash, %{"type" => "JSON"})) |
|
|
|
get(conn, address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash, %{"type" => "JSON"})) |
|
|
|
|
|
|
|
|
|
|
|
expected_response = |
|
|
|
expected_response = |
|
|
|
address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash, %{ |
|
|
|
address_internal_transaction_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash), %{ |
|
|
|
"block_number" => number, |
|
|
|
"block_number" => number, |
|
|
|
"index" => 11, |
|
|
|
"index" => 11, |
|
|
|
"transaction_index" => transaction_index |
|
|
|
"transaction_index" => transaction_index |
|
|
@ -340,7 +351,12 @@ 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" |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
assert %{"next_page_path" => nil} = json_response(conn, 200) |
|
|
|
assert %{"next_page_path" => nil} = json_response(conn, 200) |
|
|
|
end |
|
|
|
end |
|
|
|