Update AuthorRole to set author_id.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
9ad3ca2ee1
commit
70542781c2
@ -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
|
Loading…
Reference in new issue