Skip to content

Commit

Permalink
Add test demonstrating odd behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Baker committed Sep 5, 2023
1 parent 2ba17d8 commit 28f26f6
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/absinthe/phase/execution/non_null_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ defmodule Absinthe.Phase.Document.Execution.NonNullTest do
resolve &things_resolver/3
end

field :non_null_list_of_non_null_list_of_nullable,
non_null(list_of(non_null(list_of(:string)))) do
resolve fn _, _ ->
{:ok, [["ok", nil]]}
end
end

@desc """
A field declared to be non null.
Expand Down Expand Up @@ -217,6 +224,17 @@ defmodule Absinthe.Phase.Document.Execution.NonNullTest do
end

describe "lists" do
test "a field that is a non-null list of a non-null list of a nullable value will return a null value" do
doc = """
{
nonNullListOfNonNullListOfNullable
}
"""

assert {:ok, %{data: %{"nonNullListOfNonNullListOfNullable" => [["ok", nil]]}}} ==
Absinthe.run(doc, Schema)
end

test "list of nullable things returns an error when child has a null violation" do
doc = """
{
Expand Down

0 comments on commit 28f26f6

Please sign in to comment.