|
|
|
@ -29,4 +29,22 @@ defmodule DecentralisedBookIndex.Metadata.AuthorTest do
|
|
|
|
|
Metadata.add_author_to_related_alias_registry("Author2", "An description2", nil)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
describe "authors alternatives names" do
|
|
|
|
|
test "new author has no alternatives names" do
|
|
|
|
|
{:ok, author} = Metadata.create_author("Author", "An description")
|
|
|
|
|
assert {:ok, alternatives_names} = Metadata.get_author_alternative_names(author)
|
|
|
|
|
assert alternatives_names = []
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
test "author has related author so they has one alternative name" do
|
|
|
|
|
{:ok, related_author} = Metadata.create_author("Author", "An description")
|
|
|
|
|
|
|
|
|
|
{:ok, author} =
|
|
|
|
|
Metadata.add_author_to_related_alias_registry("Author2", "An description2", related_author.id)
|
|
|
|
|
|
|
|
|
|
assert {:ok, alternatives_names} = Metadata.get_author_alternative_names(author)
|
|
|
|
|
assert alternatives_names = [related_author]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|