Add the action to get author's ids.

This commit is contained in:
2025-03-13 18:54:42 +02:00
parent c546c61268
commit d6eef962de
3 changed files with 40 additions and 0 deletions
@@ -47,4 +47,27 @@ defmodule DecentralisedBookIndex.Metadata.AuthorTest do
assert alternatives_names = [related_author]
end
end
describe "author's ids" do
test "the list has the author's id" do
{:ok, author} = Metadata.create_author("Author", "An description")
assert {:ok, ids} = Metadata.get_author_ids(author)
assert author.id in ids
end
test "the list has the aliases' ids" do
{:ok, author} = Metadata.create_author("Author", "An description")
{:ok, alias1} =
Metadata.add_author_to_related_alias_registry("Author2", "An description2", author.id)
{:ok, alias2} =
Metadata.add_author_to_related_alias_registry("Author3", "An description3", author.id)
assert {:ok, ids} = Metadata.get_author_ids(author)
assert author.id in ids
assert alias1.id in ids
assert alias2.id in ids
end
end
end