|
|
@ -285,8 +285,9 @@ defmodule BlockScoutWeb.ViewingAddressesTest do |
|
|
|
session |
|
|
|
session |
|
|
|
|> AddressPage.visit_page(lincoln) |
|
|
|
|> AddressPage.visit_page(lincoln) |
|
|
|
|> assert_has(AddressPage.token_transfers(count: 1)) |
|
|
|
|> assert_has(AddressPage.token_transfers(count: 1)) |
|
|
|
|> assert_has(AddressPage.token_transfer(lincoln.hash, count: 1)) |
|
|
|
|> assert_has(AddressPage.token_transfer(lincoln, count: 1)) |
|
|
|
|> assert_has(AddressPage.token_transfer(taft.hash, count: 1)) |
|
|
|
|> assert_has(AddressPage.token_transfer(taft, count: 1)) |
|
|
|
|
|
|
|
|> refute_has(AddressPage.token_transfers_expansion(transaction)) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
test "contributor can see only token transfers related to him", %{ |
|
|
|
test "contributor can see only token transfers related to him", %{ |
|
|
@ -330,9 +331,80 @@ defmodule BlockScoutWeb.ViewingAddressesTest do |
|
|
|
session |
|
|
|
session |
|
|
|
|> AddressPage.visit_page(morty) |
|
|
|
|> AddressPage.visit_page(morty) |
|
|
|
|> assert_has(AddressPage.token_transfers(count: 1)) |
|
|
|
|> assert_has(AddressPage.token_transfers(count: 1)) |
|
|
|
|> assert_has(AddressPage.token_transfer(lincoln.hash, count: 1)) |
|
|
|
|> assert_has(AddressPage.token_transfer(lincoln, count: 1)) |
|
|
|
|> assert_has(AddressPage.token_transfer(morty.hash, count: 1)) |
|
|
|
|> assert_has(AddressPage.token_transfer(morty, count: 1)) |
|
|
|
|> refute_has(AddressPage.token_transfer(taft.hash, count: 1)) |
|
|
|
|> refute_has(AddressPage.token_transfer(taft, count: 1)) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test "transactions with multiple token transfers shows only the first one by default", %{ |
|
|
|
|
|
|
|
addresses: addresses, |
|
|
|
|
|
|
|
block: block, |
|
|
|
|
|
|
|
session: session |
|
|
|
|
|
|
|
} do |
|
|
|
|
|
|
|
lincoln = addresses.lincoln |
|
|
|
|
|
|
|
taft = addresses.taft |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contract_token_address = |
|
|
|
|
|
|
|
insert( |
|
|
|
|
|
|
|
:address, |
|
|
|
|
|
|
|
contract_code: Explorer.Factory.data("contract_code") |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
insert(:token, contract_address: contract_token_address) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
transaction = |
|
|
|
|
|
|
|
:transaction |
|
|
|
|
|
|
|
|> insert(from_address: lincoln, to_address: contract_token_address) |
|
|
|
|
|
|
|
|> with_block(block) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
insert_list( |
|
|
|
|
|
|
|
3, |
|
|
|
|
|
|
|
:token_transfer, |
|
|
|
|
|
|
|
from_address: lincoln, |
|
|
|
|
|
|
|
to_address: taft, |
|
|
|
|
|
|
|
transaction: transaction, |
|
|
|
|
|
|
|
token_contract_address: contract_token_address |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
session |
|
|
|
|
|
|
|
|> AddressPage.visit_page(lincoln) |
|
|
|
|
|
|
|
|> assert_has(AddressPage.token_transfer(lincoln, count: 1)) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test "transactions with multiple token transfers shows all transferrs if expanded", %{ |
|
|
|
|
|
|
|
addresses: addresses, |
|
|
|
|
|
|
|
block: block, |
|
|
|
|
|
|
|
session: session |
|
|
|
|
|
|
|
} do |
|
|
|
|
|
|
|
lincoln = addresses.lincoln |
|
|
|
|
|
|
|
taft = addresses.taft |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
contract_token_address = |
|
|
|
|
|
|
|
insert( |
|
|
|
|
|
|
|
:address, |
|
|
|
|
|
|
|
contract_code: Explorer.Factory.data("contract_code") |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
insert(:token, contract_address: contract_token_address) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
transaction = |
|
|
|
|
|
|
|
:transaction |
|
|
|
|
|
|
|
|> insert(from_address: lincoln, to_address: contract_token_address) |
|
|
|
|
|
|
|
|> with_block(block) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
insert_list( |
|
|
|
|
|
|
|
3, |
|
|
|
|
|
|
|
:token_transfer, |
|
|
|
|
|
|
|
from_address: lincoln, |
|
|
|
|
|
|
|
to_address: taft, |
|
|
|
|
|
|
|
transaction: transaction, |
|
|
|
|
|
|
|
token_contract_address: contract_token_address |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
session |
|
|
|
|
|
|
|
|> AddressPage.visit_page(lincoln) |
|
|
|
|
|
|
|
|> click(AddressPage.token_transfers_expansion(transaction)) |
|
|
|
|
|
|
|
|> assert_has(AddressPage.token_transfer(lincoln, count: 3)) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|