Sha256: bb072f81fce7967737f7271ec807f6a2bf34bbae3a682a6d995a4738c10ecc69

Contents?: true

Size: 829 Bytes

Versions: 16

Compression:

Stored size: 829 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::StaticValidation::TypeStack do
  let(:query_string) {%|
    query getCheese {
      cheese(id: 1) { id, ... edibleFields }
    }
    fragment edibleFields on Edible { fatContent @skip(if: false)}
  |}

  it "stores up types" do
    document = GraphQL.parse(query_string)
    visitor = GraphQL::Language::Visitor.new(document)
    type_stack = GraphQL::StaticValidation::TypeStack.new(Dummy::Schema, visitor)
    checks = []
    visitor[GraphQL::Language::Nodes::Field].enter << ->(node, parent) {
      checks << type_stack.object_types.map {|t| t.name || t.kind.name }
    }
    visitor.visit

    expected = [
      ["Query", "Cheese"],
      ["Query", "Cheese", "NON_NULL"],
      ["Edible", "NON_NULL"]
    ]
    assert_equal(expected, checks)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
graphql-1.9.11 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.10 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.9 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.8 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.7 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.6 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.5 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.4 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.3 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.2 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.1 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.0 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.0.pre4 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.0.pre3 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.0.pre2 spec/graphql/static_validation/type_stack_spec.rb
graphql-1.9.0.pre1 spec/graphql/static_validation/type_stack_spec.rb