Sha256: b26dbd64d3f5a8824671faf407671a012adbfdb01c8c8b091298f086c4cc8f39

Contents?: true

Size: 1002 Bytes

Versions: 14

Compression:

Stored size: 1002 Bytes

Contents

require "spec_helper"
require 'graphql/language/parser_tests'

describe GraphQL::Language::Parser do
  include GraphQL::Language::ParserTests
  subject { GraphQL::Language::Parser }

  describe "anonymous fragment extension" do
    let(:document) { GraphQL.parse(query_string) }
    let(:query_string) {%|
      fragment on NestedType @or(something: "ok") {
        anotherNestedField
      }
    |}

    describe ".parse" do
      it "parses queries" do
        assert document
      end

      describe "visited nodes" do
        let(:fragment) { document.definitions.first }

        it "creates an anonymous fragment definition" do
          assert fragment.is_a?(GraphQL::Language::Nodes::FragmentDefinition)
          assert_equal nil, fragment.name
          assert_equal 1, fragment.selections.length
          assert_equal "NestedType", fragment.type
          assert_equal 1, fragment.directives.length
          assert_equal [2, 7], fragment.position
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
graphql-0.19.4 spec/graphql/language/parser_spec.rb
graphql-0.19.3 spec/graphql/language/parser_spec.rb
graphql-0.19.2 spec/graphql/language/parser_spec.rb
graphql-0.19.1 spec/graphql/language/parser_spec.rb
graphql-0.19.0 spec/graphql/language/parser_spec.rb
graphql-0.18.15 spec/graphql/language/parser_spec.rb
graphql-0.18.14 spec/graphql/language/parser_spec.rb
graphql-0.18.13 spec/graphql/language/parser_spec.rb
graphql-0.18.12 spec/graphql/language/parser_spec.rb
graphql-0.18.11 spec/graphql/language/parser_spec.rb
graphql-0.18.10 spec/graphql/language/parser_spec.rb
graphql-0.18.9 spec/graphql/language/parser_spec.rb
graphql-0.18.8 spec/graphql/language/parser_spec.rb
graphql-0.18.7 spec/graphql/language/parser_spec.rb