Add the action to get Book by a BookId.
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-03-14 11:53:04 +02:00
parent 23cfb1009a
commit 5f064a3235
3 changed files with 30 additions and 0 deletions
@@ -117,4 +117,26 @@ defmodule DecentralisedBookIndex.Metadata.BookTest do
assert book3.id in book_ids
end
end
describe "get a book by book id" do
test "get by bid" do
{:ok, author} = Metadata.create_author("Author", "An description")
type = "isbn10"
bid = "1234567890"
bids = [
%{order: 1, type: type, bid: bid}
]
author_roles = [
%{order: 1, author_id: author.id, role: ""}
]
{:ok, expected_book} = Metadata.create_book("Book", "An description", bids, author_roles)
assert {:ok, book} = Metadata.get_book_by_bid(type, bid)
assert expected_book.id == book.id
end
end
end