Merge pull request #307 from poanetwork/fix-display-internal-transactions-type-create-#296
Show correct internal transaction type and contract linkpull/315/head
commit
3e6aab55e3
@ -1,4 +1,9 @@ |
||||
defmodule ExplorerWeb.InternalTransactionView do |
||||
use ExplorerWeb, :view |
||||
@dialyzer :no_match |
||||
|
||||
alias Explorer.Chain.InternalTransaction |
||||
|
||||
def create?(%InternalTransaction{type: :create}), do: true |
||||
def create?(_), do: false |
||||
end |
||||
|
@ -0,0 +1,19 @@ |
||||
defmodule ExplorerWeb.InternalTransactionViewTest do |
||||
use ExplorerWeb.ConnCase, async: true |
||||
|
||||
alias ExplorerWeb.InternalTransactionView |
||||
|
||||
describe "create?/1" do |
||||
test "with internal transaction of type create returns true" do |
||||
internal_transaction = build(:internal_transaction_create) |
||||
|
||||
assert InternalTransactionView.create?(internal_transaction) |
||||
end |
||||
|
||||
test "with non-create type internal transaction returns false" do |
||||
internal_transaction = build(:internal_transaction) |
||||
|
||||
refute InternalTransactionView.create?(internal_transaction) |
||||
end |
||||
end |
||||
end |
Loading…
Reference in new issue