Update the create action for Author to set AuthorAliasRegistry.

This commit is contained in:
2025-03-07 13:47:15 +02:00
parent 580d1d2d66
commit f2f4990779
3 changed files with 38 additions and 1 deletions
@@ -0,0 +1,18 @@
defmodule DecentralisedBookIndex.Metadata.AuthorTest do
use DecentralisedBookIndex.DataCase, async: true
alias DecentralisedBookIndex.Metadata
describe "authors and registries relationship" do
test "a new author get new registry by default" do
assert {:ok, author} = Metadata.create_author("Author", "An description")
assert author.author_alias_registry_id != nil
end
test "a new author belongs to a registry if specified" do
assert {:ok, registry} = Metadata.create_author_alias_registry()
assert {:ok, author} = Metadata.create_author("Author", "An description", registry.id)
assert author.author_alias_registry_id == registry.id
end
end
end