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/internal_transaction_test.exs

52 lines
1.3 KiB

defmodule Explorer.InternalTransactionTest do
use Explorer.DataCase
alias Explorer.InternalTransaction
describe "changeset/2" do
test "with valid attributes" do
transaction = insert(:transaction)
changeset =
InternalTransaction.changeset(%InternalTransaction{}, %{
transaction_id: transaction.id,
index: 0,
call_type: "call",
trace_address: [0, 1],
value: 100,
gas: 100,
gas_used: 100,
input: "pintos",
output: "refried",
to_address_id: 1,
from_address_id: 2
})
assert changeset.valid?
end
test "with invalid attributes" do
changeset = InternalTransaction.changeset(%InternalTransaction{}, %{falala: "falafel"})
refute changeset.valid?
end
test "that a valid changeset is persistable" do
transaction = insert(:transaction)
changeset =
InternalTransaction.changeset(%InternalTransaction{}, %{
transaction: transaction,
index: 0,
call_type: "call",
trace_address: [0, 1],
value: 100,
gas: 100,
gas_used: 100,
input: "thin-mints",
output: "munchos"
})
assert Repo.insert(changeset)
end
end
end