fix remaining tests

pull/2888/head
Ayrat Badykov 5 years ago
parent d37fb1d579
commit f17ba4db8c
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 38
      apps/explorer/test/explorer/chain/import/runner/blocks_test.exs
  2. 2
      apps/explorer/test/explorer/chain/import_test.exs

@ -115,44 +115,6 @@ defmodule Explorer.Chain.Import.Runner.BlocksTest do
assert count(Address.CurrentTokenBalance) == count
end
test "remove_nonconsensus_token_transfers deletes token transfer rows with matching block number when new consensus block is inserted",
%{consensus_block: %{number: block_number} = block, options: options} do
consensus_block = insert(:block, number: block_number, consensus: true)
transaction = insert(:transaction) |> with_block(consensus_block)
%TokenTransfer{transaction_hash: transaction_hash, log_index: log_index} =
insert(:token_transfer, block_number: block_number, transaction: transaction)
assert count(TokenTransfer) == 1
assert {:ok,
%{
remove_nonconsensus_token_transfers: [
%{transaction_hash: ^transaction_hash, log_index: ^log_index}
]
}} = run_block_consensus_change(block, true, options)
assert count(TokenTransfer) == 0
end
test "remove_nonconsensus_token_transfers does not delete token transfer rows with matching block number when new consensus block wasn't inserted",
%{consensus_block: %{number: block_number} = block, options: options} do
consensus_block = insert(:block, number: block_number, consensus: true)
transaction = insert(:transaction) |> with_block(consensus_block)
insert(:token_transfer, block_number: block_number, transaction: transaction)
count = 1
assert count(TokenTransfer) == count
assert {:ok, %{remove_nonconsensus_token_transfers: []}} = run_block_consensus_change(block, false, options)
assert count(TokenTransfer) == count
end
test "remove_nonconsensus_logs deletes nonconsensus logs", %{
consensus_block: %{number: block_number} = block,
options: options

@ -149,6 +149,7 @@ defmodule Explorer.Chain.ImportTest do
%{
amount: Decimal.new(1_000_000_000_000_000_000),
block_number: 37,
block_hash: "0xf6b4b8c88df3ebd252ec476328334dc026cf66606a84fb769b3d3cbccc8471bd",
log_index: 0,
from_address_hash: "0xe8ddc5c7a2d2f0d7a9798459c0104fdf5e987aca",
to_address_hash: "0x515c09c5bba1ed566b02a5b0599ec5d5d0aee73d",
@ -1571,6 +1572,7 @@ defmodule Explorer.Chain.ImportTest do
params: [
params_for(
:token_transfer,
block_hash: block_hash,
block_number: 35,
from_address_hash: from_address_hash,
to_address_hash: to_address_hash,

Loading…
Cancel
Save