mirror of
https://github.com/ash-project/ash_graphql.git
synced 2024-09-21 05:43:28 +12:00
9674614b62
* fix: regenerate spark formatter and cheatsheet Make CI pass again * feat: allow resources without types Ensure they only expose generic action queries. Add checks to ensure that either `type :resource_type` or `generate_object? false` is passed if it's needed. Close #119
26 lines
693 B
Elixir
26 lines
693 B
Elixir
defmodule AshGraphql.ResourceTest do
|
|
use ExUnit.Case
|
|
|
|
test "object generated according to generate_object?" do
|
|
assert %Absinthe.Type.Object{
|
|
identifier: :user
|
|
} = Absinthe.Schema.lookup_type(AshGraphql.Test.Schema, :user)
|
|
|
|
assert nil == Absinthe.Schema.lookup_type(AshGraphql.Test.Schema, :no_object)
|
|
end
|
|
|
|
test "resource with no type can execute generic queries" do
|
|
resp =
|
|
"""
|
|
query NoObjectCount {
|
|
noObjectCount
|
|
}
|
|
"""
|
|
|> Absinthe.run(AshGraphql.Test.Schema)
|
|
|
|
assert {:ok, result} = resp
|
|
|
|
refute Map.has_key?(result, :errors)
|
|
assert %{data: %{"noObjectCount" => [1, 2, 3, 4, 5]}} = result
|
|
end
|
|
end
|