Skip to content

Commit

Permalink
test: test atom type wrapper (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
revati authored Jun 10, 2024
1 parent a655cdb commit 2970af4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/form_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,18 @@ defmodule AshPhoenix.FormTest do
"Unhandled error in form submission for AshPhoenix.Test.Comment.create_with_unknown_error"
end

test "empty atom field" do

Check failure on line 61 in test/form_test.exs

View workflow job for this annotation

GitHub Actions / ash-ci / mix test

test validate_opts empty atom field (AshPhoenix.FormTest)
form =

Check warning on line 62 in test/form_test.exs

View workflow job for this annotation

GitHub Actions / ash-ci / mix test

variable "form" is unused (if the variable is not meant to be used, prefix it with an underscore)
Post
|> Form.for_create(:create,
domain: Domain,
params: %{}
)
|> Form.submit!(
params: %{"inline_atom_field" => "", "custom_atom_field" => "", "text" => "text"}
)
end

test "update_form marks touched by default" do
form =
Post
Expand Down
3 changes: 3 additions & 0 deletions test/support/resources/atom_type.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
defmodule AshPhoenix.Test.Action do
use Ash.Type.NewType, subtype_of: :atom
end
2 changes: 2 additions & 0 deletions test/support/resources/post.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ defmodule AshPhoenix.Test.Post do
attribute(:union_array, {:array, AshPhoenix.Test.UnionValue}, public?: true)
attribute(:list_of_ints, {:array, :integer}, public?: true)
attribute(:title, :string, public?: true)
attribute(:inline_atom_field, :atom, public?: true)
attribute(:custom_atom_field, AshPhoenix.Test.Action, public?: true)
end

actions do
Expand Down

0 comments on commit 2970af4

Please sign in to comment.