Update to refactor tests for Author and Book.

dev
KKlochko 3 months ago
parent 89c871110c
commit 8a3b522049

@ -56,7 +56,7 @@ defmodule DecentralisedBookIndex.Metadata.AuthorTest do
test "new author has no alternatives names", %{user: user} do
{:ok, author} = Metadata.create_author("Author", "An description", nil, nil, actor: user)
assert {:ok, alternatives_names} = Metadata.get_author_alternative_names(author)
assert alternatives_names = []
assert ^alternatives_names = []
end
test "author has related author so they has one alternative name", %{user: user} do
@ -73,7 +73,7 @@ defmodule DecentralisedBookIndex.Metadata.AuthorTest do
)
assert {:ok, alternatives_names} = Metadata.get_author_alternative_names(author)
assert alternatives_names = [related_author]
assert get_ids(alternatives_names) == [related_author.id]
end
end

@ -118,7 +118,8 @@ defmodule DecentralisedBookIndex.Metadata.BookTest do
bids,
author_roles,
publisher.id,
nil
nil,
actor: user
)
end
end
@ -146,7 +147,7 @@ defmodule DecentralisedBookIndex.Metadata.BookTest do
)
assert {:ok, alternatives_names} = Metadata.get_book_alternative_editions(book)
assert alternatives_names = []
assert ^alternatives_names = []
end
test "book has related book so they has one alternative name", %{user: user} do
@ -187,7 +188,7 @@ defmodule DecentralisedBookIndex.Metadata.BookTest do
)
assert {:ok, alternatives_names} = Metadata.get_book_alternative_editions(book)
assert alternatives_names = [related_book]
assert get_ids(alternatives_names) == [related_book.id]
end
end
@ -201,7 +202,7 @@ defmodule DecentralisedBookIndex.Metadata.BookTest do
%{order: 1, author_id: author.id, role: ""}
]
{:ok, book} =
{:ok, _book} =
Metadata.create_book(
"Book",
"An description",
@ -217,7 +218,7 @@ defmodule DecentralisedBookIndex.Metadata.BookTest do
actor: user
)
assert {:ok, books} = Metadata.get_author_books(author)
assert {:ok, _books} = Metadata.get_author_books(author)
end
test "get the list contains aliases' books", %{user: user} do
@ -256,7 +257,7 @@ defmodule DecentralisedBookIndex.Metadata.BookTest do
end
describe "get a book by book id" do
test "get by bid", %{user: user} do
test "get by bid" do
expected_book = generate(book())
[%Metadata.BookId{type: type, bid: bid} | _] = expected_book.bids

Loading…
Cancel
Save