Sha256: 178e057c0104204384d6d25a641c76bddc155c592df6cc21c789479be5df9220

Contents?: true

Size: 1.47 KB

Versions: 88

Compression:

Stored size: 1.47 KB

Contents

# frozen_string_literal: true
require "spec_helper"

describe "GraphQL::Introspection::INTROSPECTION_QUERY" do
  let(:query_string) { GraphQL::Introspection::INTROSPECTION_QUERY }
  let(:result) { Dummy::Schema.execute(query_string) }

  it "runs" do
    assert(result["data"])
  end

  it "handles deeply nested (<= 7) schemas" do
    query_type =  GraphQL::ObjectType.define do
      name "DeepQuery"
       field :foo do
         type !GraphQL::ListType.new(
           of_type: !GraphQL::ListType.new(
             of_type: !GraphQL::ListType.new(
               of_type: GraphQL::FLOAT_TYPE
             )
           )
         )
       end
    end

     deep_schema = GraphQL::Schema.define do
       query query_type
     end

     result = deep_schema.execute(query_string)
     assert(GraphQL::Schema::Loader.load(result))
  end

  it "doesn't handle too deeply nested (< 8) schemas" do
    query_type =  GraphQL::ObjectType.define do
      name "DeepQuery"
       field :foo do
         type !GraphQL::ListType.new(
           of_type: !GraphQL::ListType.new(
             of_type: !GraphQL::ListType.new(
               of_type: !GraphQL::ListType.new(
                 of_type: GraphQL::FLOAT_TYPE
               )
             )
           )
         )
       end
    end

     deep_schema = GraphQL::Schema.define do
       query query_type
     end

     result = deep_schema.execute(query_string)
     assert_raises(KeyError) {
       GraphQL::Schema::Loader.load(result)
     }
  end
end

Version data entries

88 entries across 88 versions & 1 rubygems

Version Path
graphql-1.8.18 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.10 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.9 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.8 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.7 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.6 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.5 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.4 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.3 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.2 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.8.17 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.8.16 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.1 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.0 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.8.15 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.0.pre4 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.8.14 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.0.pre3 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.9.0.pre2 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.8.13 spec/graphql/introspection/introspection_query_spec.rb