Sha256: d022120678297455763f9ce1f2546564f26a894fac31c9025c438d3528ded6a0

Contents?: true

Size: 1.71 KB

Versions: 88

Compression:

Stored size: 1.71 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(:result) { Dummy::Schema.execute(query_string) }

  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

88 entries across 88 versions & 1 rubygems

Version Path
graphql-1.5.5 spec/graphql/introspection/directive_type_spec.rb
graphql-1.5.4 spec/graphql/introspection/directive_type_spec.rb
graphql-1.5.3 spec/graphql/introspection/directive_type_spec.rb
graphql-1.4.5 spec/graphql/introspection/directive_type_spec.rb
graphql-1.4.4 spec/graphql/introspection/directive_type_spec.rb
graphql-1.4.3 spec/graphql/introspection/directive_type_spec.rb
graphql-1.4.2 spec/graphql/introspection/directive_type_spec.rb
graphql-1.4.1 spec/graphql/introspection/directive_type_spec.rb