Sha256: 86068ec751035ff534f9815adaccae3f97d4a4c7156824f9745891a60152bcfb

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 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) { GraphQL::Query.new(DummySchema, query_string).result }
  it 'exposes the schema' do
    expected = { "data" => { "getSchema" => {
      "__schema" => {
        "types" => DummySchema.types.values.map { |t| t.name.nil? ? (p t; raise("no name for #{t}")) : {"name" => t.name} },
        "queryType"=>{
          "fields"=>[
            {"name"=>"cheese"},
            {"name"=>"fromSource"},
            {"name"=>"favoriteEdible"},
            {"name"=>"searchDairy"},
            {"name"=>"error"},
            {"name"=>"__typename"},
            {"name"=>"__type"},
            {"name"=>"__schema"},
          ]
        },
        "mutationType"=> {
          "fields"=>[
            {"name"=>"pushValue"},
            {"name"=>"__typename"}
          ]
        },
      }
    }}}
    assert_equal(expected, result)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
graphql-0.2.0 spec/graph_ql/introspection/schema_type_spec.rb