Sha256: 4ceda8820393803ff64034f3584cc5eca4dd4f1ec9a1f09dae28640ea168643a

Contents?: true

Size: 1.14 KB

Versions: 26

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::Schema::TypeExpression do
  let(:types) { Dummy::Schema.types }
  let(:ast_node) {
    document = GraphQL.parse("query dostuff($var: #{type_name}) { id } ")
    document.definitions.first.variables.first.type
  }
  let(:type_expression_result) { GraphQL::Schema::TypeExpression.build_type(types, ast_node) }

  describe "#type" do
    describe "simple types" do
      let(:type_name) { "DairyProductInput" }
      it "it gets types from the provided types" do
        assert_equal(Dummy::DairyProductInput.graphql_definition, type_expression_result)
      end
    end

    describe "non-null types" do
      let(:type_name) { "String!"}
      it "makes non-null types" do
        assert_equal(GraphQL::STRING_TYPE.to_non_null_type,type_expression_result)
      end
    end

    describe "list types" do
      let(:type_name) { "[DairyAnimal!]!" }

      it "makes list types" do
        expected = Dummy::DairyAnimal.graphql_definition
          .to_non_null_type
          .to_list_type
          .to_non_null_type
        assert_equal(expected, type_expression_result)
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
graphql-1.8.18 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.11 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.10 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.9 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.8 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.7 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.6 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.5 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.4 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.3 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.2 spec/graphql/schema/type_expression_spec.rb
graphql-1.8.17 spec/graphql/schema/type_expression_spec.rb
graphql-1.8.16 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.1 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.0 spec/graphql/schema/type_expression_spec.rb
graphql-1.8.15 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.0.pre4 spec/graphql/schema/type_expression_spec.rb
graphql-1.8.14 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.0.pre3 spec/graphql/schema/type_expression_spec.rb
graphql-1.9.0.pre2 spec/graphql/schema/type_expression_spec.rb