This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user