Sha256: 12fc64f4ed463a95dcf97d155034d2b6a2bb358a11ea96b1d4949cfe97ccc2e5

Contents?: true

Size: 1.28 KB

Versions: 7

Compression:

Stored size: 1.28 KB

Contents

require "spec_helper"

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
graphql-1.2.6 spec/graphql/introspection/schema_type_spec.rb
graphql-1.2.5 spec/graphql/introspection/schema_type_spec.rb
graphql-1.2.4 spec/graphql/introspection/schema_type_spec.rb
graphql-1.2.3 spec/graphql/introspection/schema_type_spec.rb
graphql-1.2.2 spec/graphql/introspection/schema_type_spec.rb
graphql-1.2.1 spec/graphql/introspection/schema_type_spec.rb
graphql-1.2.0 spec/graphql/introspection/schema_type_spec.rb