pull/2888/head
Ayrat Badykov 5 years ago
parent e9c56a5d57
commit 8aa55932f7
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 24
      apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs
  2. 11
      apps/block_scout_web/test/block_scout_web/controllers/transaction_token_transfer_controller_test.exs
  3. 98
      apps/explorer/test/explorer/etherscan_test.exs

@ -1787,7 +1787,9 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do
insert(:token_transfer, %{
token_contract_address: token_address,
token_id: 666,
transaction: transaction
transaction: transaction,
block: transaction.block,
block_number: transaction.block_number
})
{:ok, _} = Chain.token_from_address_hash(token_transfer.token_contract_address_hash)
@ -1817,7 +1819,9 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do
|> insert()
|> with_block()
token_transfer = insert(:token_transfer, block: transaction.block, transaction: transaction)
token_transfer =
insert(:token_transfer, block: transaction.block, transaction: transaction, block_number: block.number)
{:ok, token} = Chain.token_from_address_hash(token_transfer.token_contract_address_hash)
params = %{
@ -1894,8 +1898,20 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do
|> insert()
|> with_block()
insert(:token_transfer, from_address: address, transaction: transaction)
insert(:token_transfer, from_address: address, token_contract_address: contract_address, transaction: transaction)
insert(:token_transfer,
from_address: address,
transaction: transaction,
block: transaction.block,
block_number: transaction.block_number
)
insert(:token_transfer,
from_address: address,
token_contract_address: contract_address,
transaction: transaction,
block: transaction.block,
block_number: transaction.block_number
)
params = %{
"module" => "account",

@ -48,9 +48,9 @@ defmodule BlockScoutWeb.TransactionTokenTransferControllerTest do
test "includes token transfers for the transaction", %{conn: conn} do
transaction = insert(:transaction) |> with_block()
insert(:token_transfer, transaction: transaction, block: transaction.block)
insert(:token_transfer, transaction: transaction, block: transaction.block, block_number: transaction.block_number)
insert(:token_transfer, transaction: transaction, block: transaction.block)
insert(:token_transfer, transaction: transaction, block: transaction.block, block_number: transaction.block_number)
path = transaction_token_transfer_path(BlockScoutWeb.Endpoint, :index, transaction.hash)
@ -107,7 +107,8 @@ defmodule BlockScoutWeb.TransactionTokenTransferControllerTest do
:token_transfer,
transaction: transaction,
log_index: log_index,
block: transaction.block
block: transaction.block,
block_number: transaction.block_number
)
end)
@ -130,7 +131,9 @@ defmodule BlockScoutWeb.TransactionTokenTransferControllerTest do
insert(
:token_transfer,
transaction: transaction,
log_index: log_index
log_index: log_index,
block_number: transaction.block_number,
block: transaction.block
)
end)

@ -828,7 +828,12 @@ defmodule Explorer.EtherscanTest do
|> insert()
|> with_block()
token_transfer = insert(:token_transfer, transaction: transaction)
token_transfer =
insert(:token_transfer,
transaction: transaction,
block: transaction.block,
block_number: transaction.block_number
)
[found_token_transfer] = Etherscan.list_token_transfers(token_transfer.from_address_hash, nil)
@ -863,9 +868,26 @@ defmodule Explorer.EtherscanTest do
|> insert()
|> with_block()
insert(:token_transfer, from_address: address1, transaction: transaction)
insert(:token_transfer, from_address: address1, transaction: transaction)
insert(:token_transfer, from_address: address2, transaction: transaction)
insert(:token_transfer,
from_address: address1,
transaction: transaction,
block: transaction.block,
block_number: transaction.block_number
)
insert(:token_transfer,
from_address: address1,
transaction: transaction,
block: transaction.block,
block_number: transaction.block_number
)
insert(:token_transfer,
from_address: address2,
transaction: transaction,
block: transaction.block,
block_number: transaction.block_number
)
found_token_transfers = Etherscan.list_token_transfers(address1.hash, nil)
@ -884,7 +906,12 @@ defmodule Explorer.EtherscanTest do
|> insert()
|> with_block()
token_transfer = insert(:token_transfer, transaction: transaction)
token_transfer =
insert(:token_transfer,
transaction: transaction,
block: transaction.block,
block_number: transaction.block_number
)
insert(:block)
@ -903,7 +930,12 @@ defmodule Explorer.EtherscanTest do
|> insert()
|> with_block()
token_transfer = insert(:token_transfer, transaction: transaction)
token_transfer =
insert(:token_transfer,
transaction: transaction,
block: transaction.block,
block_number: transaction.block_number
)
{:ok, token} = Chain.token_from_address_hash(token_transfer.token_contract_address_hash)
@ -1019,11 +1051,29 @@ defmodule Explorer.EtherscanTest do
|> insert()
|> with_block(third_block)
second_block_token_transfers = insert_list(2, :token_transfer, from_address: address, transaction: transaction2)
second_block_token_transfers =
insert_list(2, :token_transfer,
from_address: address,
transaction: transaction2,
block: transaction2.block,
block_number: transaction2.block_number
)
first_block_token_transfers = insert_list(2, :token_transfer, from_address: address, transaction: transaction3)
first_block_token_transfers =
insert_list(2, :token_transfer,
from_address: address,
transaction: transaction3,
block: transaction3.block,
block_number: transaction3.block_number
)
third_block_token_transfers = insert_list(2, :token_transfer, from_address: address, transaction: transaction1)
third_block_token_transfers =
insert_list(2, :token_transfer,
from_address: address,
transaction: transaction1,
block: transaction1.block,
block_number: transaction1.block_number
)
options1 = %{page_number: 1, page_size: 2}
@ -1076,7 +1126,12 @@ defmodule Explorer.EtherscanTest do
|> insert()
|> with_block(block)
insert(:token_transfer, from_address: address, transaction: transaction)
insert(:token_transfer,
from_address: address,
transaction: transaction,
block: block,
block_number: block.number
)
end
options = %{
@ -1105,7 +1160,12 @@ defmodule Explorer.EtherscanTest do
|> insert()
|> with_block(block)
insert(:token_transfer, from_address: address, transaction: transaction)
insert(:token_transfer,
from_address: address,
transaction: transaction,
block: block,
block_number: block.number
)
end
options = %{start_block: third_block.number}
@ -1131,7 +1191,12 @@ defmodule Explorer.EtherscanTest do
|> insert()
|> with_block(block)
insert(:token_transfer, from_address: address, transaction: transaction)
insert(:token_transfer,
from_address: address,
transaction: transaction,
block: block,
block_number: block.number
)
end
options = %{end_block: second_block.number}
@ -1160,7 +1225,14 @@ defmodule Explorer.EtherscanTest do
|> with_block()
insert(:token_transfer, from_address: address, transaction: transaction)
insert(:token_transfer, from_address: address, token_contract_address: contract_address, transaction: transaction)
insert(:token_transfer,
from_address: address,
token_contract_address: contract_address,
transaction: transaction,
block: transaction.block,
block_number: transaction.block_number
)
[found_token_transfer] = Etherscan.list_token_transfers(address.hash, contract_address.hash)

Loading…
Cancel
Save