Sha256: 36ee2a819cad537389c9f2aa999f0a1bd1a09aa609dfe5455ffb718378bf77dd

Contents?: true

Size: 1.52 KB

Versions: 17

Compression:

Stored size: 1.52 KB

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::Introspection::SchemaType do
  let(:query_string) {%|
    query getSchema {
      __schema {
        types { name }
        queryType { fields { name }}
        mutationType { fields { name }}
      }
    }
  |}
  let(:result) { Dummy::Schema.execute(query_string) }

  it "exposes the schema" do
    expected = { "data" => {
      "__schema" => {
        "types" => Dummy::Schema.types.values.map { |t| t.name.nil? ? (p t; raise("no name for #{t}")) : {"name" => t.name} },
        "queryType"=>{
          "fields"=>[
            {"name"=>"allAnimal"},
            {"name"=>"allAnimalAsCow"},
            {"name"=>"allDairy"},
            {"name"=>"allEdible"},
            {"name"=>"allEdibleAsMilk"},
            {"name"=>"cheese"},
            {"name"=>"cow"},
            {"name"=>"dairy"},
            {"name"=>"deepNonNull"},
            {"name"=>"error"},
            {"name"=>"executionError"},
            {"name"=>"executionErrorWithOptions"},
            {"name"=>"favoriteEdible"},
            {"name"=>"fromSource"},
            {"name"=>"maybeNull"},
            {"name"=>"milk"},
            {"name"=>"root"},
            {"name"=>"searchDairy"},
            {"name"=>"tracingScalar"},
            {"name"=>"valueWithExecutionError"},
          ]
        },
        "mutationType"=> {
          "fields"=>[
            {"name"=>"pushValue"},
            {"name"=>"replaceValues"},
          ]
        },
      }
    }}
    assert_equal(expected, result)
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
graphql-1.8.0.pre10 spec/graphql/introspection/schema_type_spec.rb
graphql-1.7.14 spec/graphql/introspection/schema_type_spec.rb
graphql-1.8.0.pre9 spec/graphql/introspection/schema_type_spec.rb
graphql-1.8.0.pre8 spec/graphql/introspection/schema_type_spec.rb
graphql-1.7.13 spec/graphql/introspection/schema_type_spec.rb
graphql-1.8.0.pre7 spec/graphql/introspection/schema_type_spec.rb
graphql-1.7.12 spec/graphql/introspection/schema_type_spec.rb
graphql-1.7.11 spec/graphql/introspection/schema_type_spec.rb
graphql-1.7.10 spec/graphql/introspection/schema_type_spec.rb
graphql-1.8.0.pre6 spec/graphql/introspection/schema_type_spec.rb
graphql-1.8.0.pre5 spec/graphql/introspection/schema_type_spec.rb
graphql-1.7.9 spec/graphql/introspection/schema_type_spec.rb
graphql-1.8.0.pre4 spec/graphql/introspection/schema_type_spec.rb
graphql-1.8.0.pre3 spec/graphql/introspection/schema_type_spec.rb
graphql-1.7.8 spec/graphql/introspection/schema_type_spec.rb
graphql-1.8.0.pre2 spec/graphql/introspection/schema_type_spec.rb
graphql-1.7.7 spec/graphql/introspection/schema_type_spec.rb