Blockchain explorer for Ethereum based network and a tool for inspecting and analyzing EVM based blockchains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
blockscout/test/explorer/skipped_transactions_test.exs

54 lines
1.7 KiB

defmodule Explorer.SkippedReceiptsTest do
use Explorer.DataCase
alias Explorer.SkippedReceipts
describe "first/0 when there are no transactions" do
test "returns no transactions" do
assert SkippedReceipts.first() == []
end
end
describe "first/0 when there are no skipped transactions" do
test "returns no transactions" do
transaction = insert(:transaction)
insert(:transaction_receipt, transaction: transaction)
assert SkippedReceipts.first() == []
end
end
describe "first/0 when a transaction has been skipped" do
test "returns the first skipped transaction hash" do
insert(:transaction, %{hash: "0xBEE75"})
assert SkippedReceipts.first() == ["0xBEE75"]
end
end
describe "first/1 when there are no transactions" do
test "returns no transactions" do
assert SkippedReceipts.first(1) == []
end
end
describe "first/1 when there are no skipped transactions" do
test "returns no transactions" do
transaction = insert(:transaction)
insert(:transaction_receipt, transaction: transaction)
assert SkippedReceipts.first(1) == []
end
end
describe "first/1 when a transaction has been skipped" do
test "returns the skipped transaction number" do
insert(:transaction, %{hash: "0xBEE75"})
assert SkippedReceipts.first(1) == ["0xBEE75"]
end
test "returns all the skipped transaction hashes in random order" do
insert(:transaction, %{hash: "0xBEE75"})
insert(:transaction, %{hash: "0xBE475"})
transaction_hashes = SkippedReceipts.first(100)
assert("0xBEE75" in transaction_hashes and "0xBE475" in transaction_hashes)
end
end
end