fix AddressInternalTransactionControllerTest

pull/2834/head
Ayrat Badykov 5 years ago
parent efa1f0acb4
commit 859d2e9fa5
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 30
      apps/block_scout_web/test/block_scout_web/controllers/address_internal_transaction_controller_test.exs

@ -4,7 +4,7 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do
import BlockScoutWeb.WebRouter.Helpers,
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
describe "GET index/3" do
@ -17,7 +17,15 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do
end
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)
end
@ -25,7 +33,8 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do
test "includes USD exchange rate value for address in assigns", %{conn: conn} do
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
end
@ -56,7 +65,7 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do
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)
internal_transaction_tiles = json_response(conn, 200)["items"]
@ -137,7 +146,9 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do
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)
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"}))
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,
"index" => 11,
"transaction_index" => transaction_index
@ -340,7 +351,12 @@ defmodule BlockScoutWeb.AddressInternalTransactionControllerTest do
end)
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)
end

Loading…
Cancel
Save