typeid-elixir/test/spec_test.exs
2023-07-02 08:13:02 -04:00

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