Sha256: 4f6a4efaefe268cff7275158faba27ea0605a560d23790d45f10cbd51c7fde5c

Contents?: true

Size: 1.44 KB

Versions: 10

Compression:

Stored size: 1.44 KB

Contents

require "spec_helper"

describe "GraphQL::Introspection::INTROSPECTION_QUERY" do
  let(:query_string) { GraphQL::Introspection::INTROSPECTION_QUERY }
  let(:result) { DummySchema.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

10 entries across 10 versions & 1 rubygems

Version Path
graphql-1.2.6 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.2.5 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.2.4 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.2.3 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.2.2 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.2.1 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.2.0 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.1.0 spec/graphql/introspection/introspection_query_spec.rb
graphql-1.0.0 spec/graphql/introspection/introspection_query_spec.rb
graphql-0.19.4 spec/graphql/introspection/introspection_query_spec.rb