parent
3160ac1967
commit
12e5da97cd
@ -1,4 +1,9 @@ |
|||||||
defmodule ExplorerWeb.InternalTransactionView do |
defmodule ExplorerWeb.InternalTransactionView do |
||||||
use ExplorerWeb, :view |
use ExplorerWeb, :view |
||||||
@dialyzer :no_match |
@dialyzer :no_match |
||||||
|
|
||||||
|
alias Explorer.Chain.InternalTransaction |
||||||
|
|
||||||
|
def contract?(%InternalTransaction{type: :create}), do: true |
||||||
|
def contract?(_), do: false |
||||||
end |
end |
||||||
|
@ -0,0 +1,19 @@ |
|||||||
|
defmodule ExplorerWeb.InternalTransactionViewTest do |
||||||
|
use ExplorerWeb.ConnCase, async: true |
||||||
|
|
||||||
|
alias ExplorerWeb.InternalTransactionView |
||||||
|
|
||||||
|
describe "contract?/1" do |
||||||
|
test "with internal transaction of type create returns true" do |
||||||
|
internal_transaction = build(:internal_transaction_create) |
||||||
|
|
||||||
|
assert InternalTransactionView.contract?(internal_transaction) |
||||||
|
end |
||||||
|
|
||||||
|
test "with non-create type internal transaction returns false" do |
||||||
|
internal_transaction = build(:internal_transaction) |
||||||
|
|
||||||
|
refute InternalTransactionView.contract?(internal_transaction) |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue