Add the action to get author's ids.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user