Skip to content

Commit

Permalink
extend user resolver in TestSchema: return error if user is missing i…
Browse files Browse the repository at this point in the history
…n context
  • Loading branch information
Michael Ruoss committed Apr 23, 2021
1 parent 27f61ac commit 8097a18
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions test/support/test_schema.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ defmodule Absinthe.Plug.TestSchema do
end

field :user, :string do
resolve fn _,
%{
context: %{
user: user
}
} ->
{:ok, user}
resolve fn
_, %{context: %{user: user}} ->
{:ok, user}

_, %{context: %{}} ->
{:error, "User is missing in context"}
end
end

Expand Down

0 comments on commit 8097a18

Please sign in to comment.