Update AuthorRole to set author_id.
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-03-13 17:40:41 +02:00
parent 9ad3ca2ee1
commit 70542781c2
3 changed files with 52 additions and 1 deletions
@@ -0,0 +1,27 @@
defmodule DecentralisedBookIndex.Metadata.AuthorRolesTest do
use DecentralisedBookIndex.DataCase, async: true
alias DecentralisedBookIndex.Metadata
describe "create action" do
test "an author's role must belongs to an author" do
{:ok, author} = Metadata.create_author("Author", "An description")
assert {:ok, author_role} = Metadata.create_author_role(author.id, 1, "role")
{:ok, author_role} =
author_role
|> Ash.load(:author)
assert author.id == author_role.author_id
end
test "an author's role can be blank" do
{:ok, author} = Metadata.create_author("Author", "An description")
{:ok, author_role} = Metadata.create_author_role(author.id, 1, "")
refute author_role.role
end
end
end