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_transaction_test.exs

29 lines
1.0 KiB

defmodule Explorer.Workers.ImportTransactionTest do
use Explorer.DataCase
alias Explorer.Repo
alias Explorer.Transaction
alias Explorer.Workers.ImportTransaction
describe "perform/1" do
test "imports the requested transaction hash" do
use_cassette "import_transaction_perform_1" do
ImportTransaction.perform("0xf9a0959d5ccde33ec5221ddba1c6d7eaf9580a8d3512c7a1a60301362a98f926")
transaction = Transaction |> Repo.one
assert transaction.hash == "0xf9a0959d5ccde33ec5221ddba1c6d7eaf9580a8d3512c7a1a60301362a98f926"
end
end
test "when there is already a transaction with the requested hash" do
use_cassette "import_transaction_perform_1_duplicate" do
insert(:transaction, hash: "0xdc3a0dfd0bbffd5eabbe40fb13afbe35ac5f5c030bff148f3e50afe32974b291")
ImportTransaction.perform("0xdc3a0dfd0bbffd5eabbe40fb13afbe35ac5f5c030bff148f3e50afe32974b291")
transaction_count = Transaction |> Repo.all |> Enum.count
assert transaction_count == 1
end
end
end
end