Fix flaky hashes_to_transactions tests (non-ordered results)

pull/497/head
Stamates 6 years ago committed by jimmay5469
parent d3f8e6a157
commit 8e8d23fb57
  1. 4
      apps/explorer/lib/explorer/chain.ex
  2. 8
      apps/explorer/test/explorer/chain_test.exs

@ -587,9 +587,9 @@ defmodule Explorer.Chain do
iex> [%Transaction{hash: hash1}, %Transaction{hash: hash2}] = insert_list(2, :transaction)
iex> [%Explorer.Chain.Transaction{hash: found_hash1}, %Explorer.Chain.Transaction{hash: found_hash2}] =
...> Explorer.Chain.hashes_to_transactions([hash1, hash2])
iex> found_hash1 == hash1
iex> found_hash1 in [hash1, hash2]
true
iex> found_hash2 == hash2
iex> found_hash2 in [hash1, hash2]
true
Returns `[]` if not found

@ -529,11 +529,9 @@ defmodule Explorer.ChainTest do
necessity_by_association: %{block: :required}
)
assert [%Transaction{hash: ^hash_without_index1}, %Transaction{hash: ^hash_without_index2}] =
Chain.hashes_to_transactions(
[hash_without_index1, hash_without_index2],
necessity_by_association: %{block: :optional}
)
assert [hash_without_index1, hash_without_index2]
|> Chain.hashes_to_transactions(necessity_by_association: %{block: :optional})
|> Enum.all?(&(&1.hash in [hash_without_index1, hash_without_index2]))
end
end

Loading…
Cancel
Save