|
|
@ -91,12 +91,13 @@ defmodule DecentralisedBookIndex.Metadata.Forms.BookFormTest do
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
describe "update existing book via the form" do
|
|
|
|
describe "update existing book via the form" do
|
|
|
|
test "update name", %{user: user} do
|
|
|
|
test "update title, desciption and roles", %{user: user} do
|
|
|
|
book = generate(book())
|
|
|
|
book = generate(book())
|
|
|
|
|
|
|
|
|
|
|
|
valid_params = %{
|
|
|
|
valid_params = %{
|
|
|
|
"title" => "Another Book",
|
|
|
|
"title" => "Another Book",
|
|
|
|
"description" => "A cool book"
|
|
|
|
"description" => "A cool book",
|
|
|
|
|
|
|
|
"author_roles" => author_roles()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
form =
|
|
|
|
form =
|
|
|
@ -131,6 +132,7 @@ defmodule DecentralisedBookIndex.Metadata.Forms.BookFormTest do
|
|
|
|
describe "validation" do
|
|
|
|
describe "validation" do
|
|
|
|
property "the book form is valid if the page count > 0", %{user: user} do
|
|
|
|
property "the book form is valid if the page count > 0", %{user: user} do
|
|
|
|
book = generate(book())
|
|
|
|
book = generate(book())
|
|
|
|
|
|
|
|
author_roles = author_roles()
|
|
|
|
|
|
|
|
|
|
|
|
valid_count_generator =
|
|
|
|
valid_count_generator =
|
|
|
|
StreamData.integer()
|
|
|
|
StreamData.integer()
|
|
|
@ -138,7 +140,8 @@ defmodule DecentralisedBookIndex.Metadata.Forms.BookFormTest do
|
|
|
|
|
|
|
|
|
|
|
|
check all(page_count <- valid_count_generator) do
|
|
|
|
check all(page_count <- valid_count_generator) do
|
|
|
|
valid_params = %{
|
|
|
|
valid_params = %{
|
|
|
|
"page_count" => page_count
|
|
|
|
"page_count" => page_count,
|
|
|
|
|
|
|
|
"author_roles" => author_roles
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
form =
|
|
|
|
form =
|
|
|
|