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/forms/block_form_test.exs

28 lines
808 B

defmodule Explorer.BlockFormTest do
use Explorer.DataCase
alias Explorer.BlockForm
describe "build/1" do
test "that it works" do
block = insert(:block)
assert BlockForm.build(block)
end
test "that it has a number" do
block = insert(:block, number: 311)
insert_list(2, :transaction, block: block)
assert BlockForm.build(block).number == 311
end
test "that it returns a count of transactions" do
block = insert(:block, number: 311)
insert_list(2, :transaction, block: block)
assert BlockForm.build(block).transactions_count == 2
end
test "that it returns a block's age" do
block = insert(:block, timestamp: Timex.now |> Timex.shift(hours: -1))
assert BlockForm.build(block).age == "1 hour ago"
end
end
end