|
|
|
@ -17,7 +17,7 @@ defmodule BlockScoutWeb.AddressChannelTest do |
|
|
|
|
|
|
|
|
|
Notifier.handle_event({:chain_event, :addresses, :realtime, [address]}) |
|
|
|
|
|
|
|
|
|
assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "count", payload: %{count: _}}, 5_000 |
|
|
|
|
assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "count", payload: %{count: _}}, :timer.seconds(5) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
describe "user subscribed to address" do |
|
|
|
@ -36,7 +36,9 @@ defmodule BlockScoutWeb.AddressChannelTest do |
|
|
|
|
|
|
|
|
|
Notifier.handle_event({:chain_event, :addresses, :realtime, [address_with_balance]}) |
|
|
|
|
|
|
|
|
|
assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "balance_update", payload: payload}, 5_000 |
|
|
|
|
assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "balance_update", payload: payload}, |
|
|
|
|
:timer.seconds(5) |
|
|
|
|
|
|
|
|
|
assert payload.address.hash == address_with_balance.hash |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -54,7 +56,9 @@ defmodule BlockScoutWeb.AddressChannelTest do |
|
|
|
|
|
|
|
|
|
Notifier.handle_event({:chain_event, :transactions, :realtime, [pending.hash]}) |
|
|
|
|
|
|
|
|
|
assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "pending_transaction", payload: payload}, 5_000 |
|
|
|
|
assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "pending_transaction", payload: payload}, |
|
|
|
|
:timer.seconds(5) |
|
|
|
|
|
|
|
|
|
assert payload.address.hash == address.hash |
|
|
|
|
assert payload.transaction.hash == pending.hash |
|
|
|
|
end |
|
|
|
@ -67,7 +71,7 @@ defmodule BlockScoutWeb.AddressChannelTest do |
|
|
|
|
|
|
|
|
|
Notifier.handle_event({:chain_event, :transactions, :realtime, [transaction.hash]}) |
|
|
|
|
|
|
|
|
|
assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: payload}, 5_000 |
|
|
|
|
assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: payload}, :timer.seconds(5) |
|
|
|
|
assert payload.address.hash == address.hash |
|
|
|
|
assert payload.transaction.hash == transaction.hash |
|
|
|
|
end |
|
|
|
@ -80,7 +84,7 @@ defmodule BlockScoutWeb.AddressChannelTest do |
|
|
|
|
|
|
|
|
|
Notifier.handle_event({:chain_event, :transactions, :realtime, [transaction.hash]}) |
|
|
|
|
|
|
|
|
|
assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: payload}, 5_000 |
|
|
|
|
assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: payload}, :timer.seconds(5) |
|
|
|
|
assert payload.address.hash == address.hash |
|
|
|
|
assert payload.transaction.hash == transaction.hash |
|
|
|
|
end |
|
|
|
@ -93,7 +97,7 @@ defmodule BlockScoutWeb.AddressChannelTest do |
|
|
|
|
|
|
|
|
|
Notifier.handle_event({:chain_event, :transactions, :realtime, [transaction.hash]}) |
|
|
|
|
|
|
|
|
|
assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: payload}, 5_000 |
|
|
|
|
assert_receive %Phoenix.Socket.Broadcast{topic: ^topic, event: "transaction", payload: payload}, :timer.seconds(5) |
|
|
|
|
assert payload.address.hash == address.hash |
|
|
|
|
assert payload.transaction.hash == transaction.hash |
|
|
|
|
|
|
|
|
@ -118,7 +122,7 @@ defmodule BlockScoutWeb.AddressChannelTest do |
|
|
|
|
internal_transaction: %{transaction_hash: transaction_hash, index: index} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
5_000 |
|
|
|
|
:timer.seconds(5) |
|
|
|
|
|
|
|
|
|
assert address_hash == address.hash |
|
|
|
|
assert {transaction_hash, index} == {internal_transaction.transaction_hash, internal_transaction.index} |
|
|
|
@ -142,7 +146,7 @@ defmodule BlockScoutWeb.AddressChannelTest do |
|
|
|
|
internal_transaction: %{transaction_hash: transaction_hash, index: index} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
5_000 |
|
|
|
|
:timer.seconds(5) |
|
|
|
|
|
|
|
|
|
assert address_hash == address.hash |
|
|
|
|
assert {transaction_hash, index} == {internal_transaction.transaction_hash, internal_transaction.index} |
|
|
|
@ -170,7 +174,7 @@ defmodule BlockScoutWeb.AddressChannelTest do |
|
|
|
|
internal_transaction: %{transaction_hash: transaction_hash, index: index} |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
5_000 |
|
|
|
|
:timer.seconds(5) |
|
|
|
|
|
|
|
|
|
assert address_hash == address.hash |
|
|
|
|
assert {transaction_hash, index} == {internal_transaction.transaction_hash, internal_transaction.index} |
|
|
|
|