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/transaction_log_controller_...

25 lines
955 B

defmodule ExplorerWeb.TransactionLogControllerTest do
use ExplorerWeb.ConnCase
import ExplorerWeb.Router.Helpers, only: [transaction_log_path: 4]
describe "GET index/2" do
test "returns logs for the transaction", %{conn: conn} do
transaction = insert(:transaction)
receipt = insert(:receipt, transaction: transaction)
address = insert(:address)
insert(:log, receipt: receipt, address: address)
path = transaction_log_path(ExplorerWeb.Endpoint, :index, :en, transaction.hash)
conn = get(conn, path)
first_log = List.first(conn.assigns.logs.entries)
assert first_log.receipt_id == receipt.id
end
test "assigns no logs when there are none", %{conn: conn} do
transaction = insert(:transaction)
path = transaction_log_path(ExplorerWeb.Endpoint, :index, :en, transaction.hash)
conn = get(conn, path)
assert Enum.count(conn.assigns.logs.entries) == 0
end
end
end