fix AddressTransactionControllerTest

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

@ -3,7 +3,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do
import BlockScoutWeb.WebRouter.Helpers, only: [address_transaction_path: 3, address_transaction_path: 4]
alias Explorer.Chain.Transaction
alias Explorer.Chain.{Address, Transaction}
alias Explorer.ExchangeRates.Token
describe "GET index/2" do
@ -17,7 +17,9 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do
conn =
get(
conn,
address_transaction_path(conn, :index, "0x8bf38d4764929064f2d4d3a56520a76ab3df415b", %{"type" => "JSON"})
address_transaction_path(conn, :index, Address.checksum("0x8bf38d4764929064f2d4d3a56520a76ab3df415b"), %{
"type" => "JSON"
})
)
assert json_response(conn, 200)
@ -73,7 +75,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do
|> with_block()
conn =
get(conn, address_transaction_path(BlockScoutWeb.Endpoint, :index, address.hash), %{
get(conn, address_transaction_path(BlockScoutWeb.Endpoint, :index, Address.checksum(address.hash)), %{
"block_number" => Integer.to_string(block_number),
"index" => Integer.to_string(index),
"type" => "JSON"
@ -94,7 +96,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do
|> insert_list(:transaction, from_address: address)
|> with_block(block)
conn = get(conn, address_transaction_path(conn, :index, address.hash, %{"type" => "JSON"}))
conn = get(conn, address_transaction_path(conn, :index, Address.checksum(address.hash), %{"type" => "JSON"}))
assert json_response(conn, 200)["next_page_path"]
end
@ -151,7 +153,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do
insert(:token_transfer, transaction: transaction, from_address: address)
insert(:token_transfer, transaction: transaction, to_address: address)
conn = get(conn, "/token_transfers_csv", %{"address_id" => to_string(address.hash)})
conn = get(conn, "/token_transfers_csv", %{"address_id" => Address.checksum(address.hash)})
assert conn.resp_body |> String.split("\n") |> Enum.count() == 4
end
@ -169,7 +171,7 @@ defmodule BlockScoutWeb.AddressTransactionControllerTest do
|> insert(from_address: address)
|> with_block()
conn = get(conn, "/transactions_csv", %{"address_id" => to_string(address.hash)})
conn = get(conn, "/transactions_csv", %{"address_id" => Address.checksum(address.hash)})
assert conn.resp_body |> String.split("\n") |> Enum.count() == 4
end

Loading…
Cancel
Save