Skip to content

Commit

Permalink
test: add test for Vx.Type.of/1
Browse files Browse the repository at this point in the history
  • Loading branch information
tlux committed Mar 26, 2024
1 parent 97a928b commit 2fa5a78
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/vx/type_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,19 @@ defmodule Vx.TypeTest do
assert Vx.Type.constraints(schema) == Enum.reverse(constraints)
end
end

describe "of/1" do
test "plain type" do
of = [Vx.String.t, Vx.Integer.t]
type = %{Vx.Type.new(:foo, fn _ -> :ok end) | of: of}

assert Vx.Type.of(type) == of
end

test "wrapped type" do
type = Vx.List.t(Vx.String.t)

assert Vx.Type.of(type) == [Vx.String.t]
end
end
end

0 comments on commit 2fa5a78

Please # to comment.