Sha256: 0075b24a39b7313b8d4350af4954c7becfc98889574a95c297c97fcf5201c88f

Contents?: true

Size: 1.79 KB

Versions: 1

Compression:

Stored size: 1.79 KB

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::Introspection::DirectiveType do
  let(:query_string) {%|
    query getDirectives {
      __schema {
        directives {
          name,
          args { name, type { kind, name, ofType { name } } },
          locations
          # Deprecated fields:
          onField
          onFragment
          onOperation
        }
      }
    }
  |}

  let(:schema) { Class.new(Dummy::Schema) }
  let(:result) { schema.execute(query_string) }
  before do
    schema.max_depth(100)
  end

  it "shows directive info " do
    expected = { "data" => {
      "__schema" => {
        "directives" => [
          {
            "name" => "include",
            "args" => [
              {"name"=>"if", "type"=>{"kind"=>"NON_NULL", "name"=>nil, "ofType"=>{"name"=>"Boolean"}}}
            ],
            "locations"=>["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"],
            "onField" => true,
            "onFragment" => true,
            "onOperation" => false,
          },
          {
            "name" => "skip",
            "args" => [
              {"name"=>"if", "type"=>{"kind"=>"NON_NULL", "name"=>nil, "ofType"=>{"name"=>"Boolean"}}}
            ],
            "locations"=>["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"],
            "onField" => true,
            "onFragment" => true,
            "onOperation" => false,
          },
          {
            "name" => "deprecated",
            "args" => [
              {"name"=>"reason", "type"=>{"kind"=>"SCALAR", "name"=>"String", "ofType"=>nil}}
            ],
            "locations"=>["FIELD_DEFINITION", "ENUM_VALUE"],
            "onField" => false,
            "onFragment" => false,
            "onOperation" => false,
          },
        ]
      }
    }}
    assert_equal(expected, result)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graphql-1.9.11 spec/graphql/introspection/directive_type_spec.rb