mirror of
https://github.com/sloanelybutsurely/typeid-elixir.git
synced 2024-11-28 01:42:54 -05:00
20 lines
596 B
Elixir
20 lines
596 B
Elixir
defmodule TypeID.SpecTest do
|
|
use ExUnit.Case
|
|
|
|
@valid_specs :code.priv_dir(:typeid_elixir)
|
|
|> Path.join("spec/valid.yml")
|
|
|> YamlElixir.read_from_file!()
|
|
|
|
describe "valid" do
|
|
for %{"name" => name, "typeid" => typeid, "prefix" => prefix, "uuid" => uuid} <- @valid_specs do
|
|
test "#{name}" do
|
|
assert {:ok, tid} = TypeID.from_uuid(unquote(prefix), unquote(uuid))
|
|
assert unquote(typeid) == TypeID.to_string(tid)
|
|
assert {:ok, ^tid} = TypeID.from_string(unquote(typeid))
|
|
end
|
|
end
|
|
end
|
|
|
|
# describe "invalid" do
|
|
# end
|
|
end
|