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.8.18 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.10 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.9 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.8 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.7 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.6 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.5 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.4 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.3 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.2 spec/graphql/introspection/directive_type_spec.rb
graphql-1.8.17 spec/graphql/introspection/directive_type_spec.rb
graphql-1.8.16 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.1 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.0 spec/graphql/introspection/directive_type_spec.rb
graphql-1.8.15 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.0.pre4 spec/graphql/introspection/directive_type_spec.rb
graphql-1.8.14 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.0.pre3 spec/graphql/introspection/directive_type_spec.rb
graphql-1.9.0.pre2 spec/graphql/introspection/directive_type_spec.rb
graphql-1.8.13 spec/graphql/introspection/directive_type_spec.rb