mirror of
https://github.com/ash-project/ash_phoenix.git
synced 2024-09-20 07:12:49 +12:00
test: Add failing test (#9)
This commit is contained in:
parent
948dde6f4b
commit
785263e514
1 changed files with 35 additions and 0 deletions
|
@ -552,5 +552,40 @@ defmodule AshPhoenix.FormTest do
|
||||||
assert [%Phoenix.HTML.Form{source: %AshPhoenix.Form{resource: AshPhoenix.Test.Post}}] =
|
assert [%Phoenix.HTML.Form{source: %AshPhoenix.Form{resource: AshPhoenix.Test.Post}}] =
|
||||||
inputs_for(form_for(form, "action"), :post)
|
inputs_for(form_for(form, "action"), :post)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "failing single intermediate form" do
|
||||||
|
post_id = Ash.UUID.generate()
|
||||||
|
comment = %Comment{text: "text", post: %Post{id: post_id, text: "Some text"}}
|
||||||
|
|
||||||
|
form =
|
||||||
|
comment
|
||||||
|
|> Form.for_update(:update,
|
||||||
|
forms: [
|
||||||
|
post: [
|
||||||
|
data: comment.post,
|
||||||
|
type: :single,
|
||||||
|
resource: Post,
|
||||||
|
update_action: :update,
|
||||||
|
create_action: :create,
|
||||||
|
forms: [
|
||||||
|
comments: [
|
||||||
|
data: & &1.comments,
|
||||||
|
type: :list,
|
||||||
|
resource: Comment,
|
||||||
|
update_action: :update,
|
||||||
|
create_action: :create
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
assert [%Phoenix.HTML.Form{source: %AshPhoenix.Form{resource: AshPhoenix.Test.Post}}] =
|
||||||
|
form
|
||||||
|
|> form_for("action")
|
||||||
|
|> inputs_for(:post)
|
||||||
|
|> hd()
|
||||||
|
|> inputs_for(:comments)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue