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/workers/import_receipt_test.exs

35 lines
990 B

defmodule Explorer.Workers.ImportReceiptTest do
use Explorer.DataCase
alias Explorer.Repo
alias Explorer.Receipt
alias Explorer.Workers.ImportReceipt
describe "perform/1" do
test "does not import a receipt when no transaction with the hash exists" do
use_cassette "import_receipt_perform_1" do
ImportReceipt.perform(
"0xf9a0959d5ccde33ec5221ddba1c6d7eaf9580a8d3512c7a1a60301362a98f926"
)
assert Repo.one(Receipt) == nil
end
end
test "imports a receipt when a transaction with the hash exists" do
insert(
:transaction,
hash: "0xf9a0959d5ccde33ec5221ddba1c6d7eaf9580a8d3512c7a1a60301362a98f926"
)
use_cassette "import_receipt_perform_1" do
ImportReceipt.perform(
"0xf9a0959d5ccde33ec5221ddba1c6d7eaf9580a8d3512c7a1a60301362a98f926"
)
receipt_count = Receipt |> Repo.all() |> Enum.count()
assert receipt_count == 1
end
end
end
end