mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-19 12:53:40 +12:00
chore: Add failing test case for string union values parsed as numbers.
This commit is contained in:
parent
2c83029478
commit
094a43a9f6
1 changed files with 48 additions and 0 deletions
|
@ -146,6 +146,54 @@ defmodule AshGraphql.CreateTest do
|
||||||
} = result
|
} = result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "an embedded union type uses the correct types" do
|
||||||
|
assert {:ok, resp} =
|
||||||
|
"""
|
||||||
|
mutation SimpleCreatePost($input: SimpleCreatePostInput) {
|
||||||
|
simpleCreatePost(input: $input) {
|
||||||
|
result{
|
||||||
|
text1
|
||||||
|
simpleUnion {
|
||||||
|
... on SimpleUnionString {
|
||||||
|
value
|
||||||
|
}
|
||||||
|
... on SimpleUnionInt {
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errors{
|
||||||
|
message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|> Absinthe.run(AshGraphql.Test.Schema,
|
||||||
|
variables: %{
|
||||||
|
"input" => %{
|
||||||
|
"text1" => "foo",
|
||||||
|
"simpleUnion" => %{
|
||||||
|
"string" => "5"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
refute Map.has_key?(resp, :errors)
|
||||||
|
|
||||||
|
assert %{
|
||||||
|
data: %{
|
||||||
|
"simpleCreatePost" => %{
|
||||||
|
"result" => %{
|
||||||
|
"simpleUnion" => %{
|
||||||
|
"value" => "5"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} = resp
|
||||||
|
end
|
||||||
|
|
||||||
test "an embedded union type can be written to" do
|
test "an embedded union type can be written to" do
|
||||||
resp =
|
resp =
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue