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_web/controllers/pending_transaction_control...

22 lines
834 B

defmodule ExplorerWeb.PendingTransactionControllerTest do
use ExplorerWeb.ConnCase
import ExplorerWeb.Router.Helpers, only: [pending_transaction_path: 3]
describe "GET index/2" do
test "does not return transactions with a block", %{conn: conn} do
block = insert(:block)
transaction = insert(:transaction)
insert(:block_transaction, block: block, transaction: transaction)
conn = get(conn, pending_transaction_path(ExplorerWeb.Endpoint, :index, :en))
assert conn.assigns.transactions |> Enum.count == 0
end
test "returns pending transactions", %{conn: conn} do
transaction = insert(:transaction)
conn = get(conn, pending_transaction_path(ExplorerWeb.Endpoint, :index, :en))
assert List.first(conn.assigns.transactions.entries).id == transaction.id
end
end
end