|
|
|
@ -1,6 +1,9 @@ |
|
|
|
|
defmodule ExplorerWeb.ViewingAddressesTest do |
|
|
|
|
use ExplorerWeb.FeatureCase, async: true |
|
|
|
|
|
|
|
|
|
alias Explorer.Chain |
|
|
|
|
alias Explorer.Chain.Address |
|
|
|
|
alias Explorer.ExchangeRates.Token |
|
|
|
|
alias ExplorerWeb.{AddressPage, HomePage} |
|
|
|
|
|
|
|
|
|
setup do |
|
|
|
@ -161,7 +164,26 @@ defmodule ExplorerWeb.ViewingAddressesTest do |
|
|
|
|
|
|
|
|
|
ExplorerWeb.Endpoint.broadcast!("addresses:#{addresses.lincoln.hash}", "transaction", %{transaction: transaction}) |
|
|
|
|
|
|
|
|
|
assert_has(session, AddressPage.transaction(transaction)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
test "viewing updated overview via live update", %{session: session} do |
|
|
|
|
address = %Address{hash: hash} = insert(:address, fetched_balance: 500) |
|
|
|
|
|
|
|
|
|
session |
|
|
|
|
|> assert_has(AddressPage.transaction(transaction)) |
|
|
|
|
|> AddressPage.visit_page(address) |
|
|
|
|
|> assert_text(AddressPage.balance(), "0.0000000000000005 POA") |
|
|
|
|
|
|
|
|
|
{:ok, [^hash]} = Chain.update_balances([%{ |
|
|
|
|
fetched_balance: 100, |
|
|
|
|
fetched_balance_block_number: 1, |
|
|
|
|
hash: hash |
|
|
|
|
}]) |
|
|
|
|
|
|
|
|
|
{:ok, updated_address} = Chain.hash_to_address(hash) |
|
|
|
|
|
|
|
|
|
ExplorerWeb.Endpoint.broadcast!("addresses:#{hash}", "overview", %{address: updated_address, exchange_rate: %Token{}, transaction_count: 1}) |
|
|
|
|
|
|
|
|
|
assert_text(session, AddressPage.balance(), "0.0000000000000001 POA") |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|