mirror of
https://github.com/ash-project/ash_phoenix.git
synced 2024-09-20 07:12:49 +12:00
test: added failing test (#40)
This commit is contained in:
parent
12b27461b6
commit
a861dbf3b9
2 changed files with 15 additions and 0 deletions
|
@ -1160,6 +1160,16 @@ defmodule AshPhoenix.FormTest do
|
|||
|
||||
assert is_nil(Map.get(params, "author", "shouldn't exist"))
|
||||
end
|
||||
|
||||
test "when add_forming a required argument, the added form should be valid without needing to manually validate it" do
|
||||
form =
|
||||
Post
|
||||
|> Form.for_create(:create_author_required, api: Api, forms: [auto?: true])
|
||||
|> Form.validate(%{"text" => "foo"})
|
||||
|> Form.add_form([:author], params: %{"email" => "james@foo.com"})
|
||||
|
||||
assert form.valid? == true
|
||||
end
|
||||
end
|
||||
|
||||
describe "issue #259" do
|
||||
|
|
|
@ -25,6 +25,11 @@ defmodule AshPhoenix.Test.Post do
|
|||
change(manage_relationship(:author, type: :direct_control, on_missing: :unrelate))
|
||||
end
|
||||
|
||||
create :create_author_required do
|
||||
argument(:author, :map, allow_nil?: false)
|
||||
change(manage_relationship(:author, type: :direct_control, on_missing: :unrelate))
|
||||
end
|
||||
|
||||
update :update_with_replace do
|
||||
argument(:comments, {:array, :map})
|
||||
change(manage_relationship(:comments, type: :replace))
|
||||
|
|
Loading…
Reference in a new issue