mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-19 12:53:40 +12:00
add better regression test
This commit is contained in:
parent
a5583ff8dc
commit
13d1b40b2f
1 changed files with 29 additions and 0 deletions
|
@ -25,6 +25,35 @@ defmodule AshGraphql.GenericActionsTest do
|
|||
assert %{data: %{"postCount" => 0}} = result
|
||||
end
|
||||
|
||||
test "generic action that have policies return forbidden if no actor is present" do
|
||||
resp =
|
||||
"""
|
||||
query {
|
||||
postCount
|
||||
}
|
||||
"""
|
||||
|> Absinthe.run(AshGraphql.Test.Schema)
|
||||
|
||||
assert {:ok, result} = resp
|
||||
|
||||
assert Map.has_key?(result, :errors)
|
||||
|
||||
assert %{
|
||||
data: nil,
|
||||
errors: [
|
||||
%{
|
||||
code: "forbidden",
|
||||
message: "forbidden",
|
||||
path: ["postCount"],
|
||||
fields: [],
|
||||
vars: %{},
|
||||
locations: [%{line: 2, column: 3}],
|
||||
short_message: "forbidden"
|
||||
}
|
||||
]
|
||||
} == result
|
||||
end
|
||||
|
||||
test "generic action mutations can be run" do
|
||||
post = AshGraphql.Test.Api.create!(Ash.Changeset.new(AshGraphql.Test.Post, text: "foobar"))
|
||||
|
||||
|
|
Loading…
Reference in a new issue