Sha256: 23784d140956323c1dccd35351296a32521a10401305c2049658de3e1b08569f

Contents?: true

Size: 1019 Bytes

Versions: 14

Compression:

Stored size: 1019 Bytes

Contents

require "spec_helper"

describe GraphQL::Schema::TypeExpression do
  let(:schema) { DummySchema }
  let(:ast_node) {
    ast = GraphQL::PARSER.type.parse(type_name)
    GraphQL::TRANSFORM.apply(ast)
  }
  let(:type_expression) { GraphQL::Schema::TypeExpression.new(schema, ast_node) }

  describe "#type" do
    describe "simple types" do
      let(:type_name) { "DairyProductInput" }
      it "it gets types from the schema" do
        assert_equal(DairyProductInputType, type_expression.type)
      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.type)
      end
    end

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

      it "makes list types" do
        expected = DairyAnimalEnum
          .to_non_null_type
          .to_list_type
          .to_non_null_type
        assert_equal(expected, type_expression.type)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
graphql-0.12.1 spec/graphql/schema/type_expression_spec.rb
graphql-0.12.0 spec/graphql/schema/type_expression_spec.rb
graphql-0.11.1 spec/graphql/schema/type_expression_spec.rb
graphql-0.11.0 spec/graphql/schema/type_expression_spec.rb
graphql-0.10.9 spec/graphql/schema/type_expression_spec.rb
graphql-0.10.8 spec/graphql/schema/type_expression_spec.rb
graphql-0.10.7 spec/graphql/schema/type_expression_spec.rb
graphql-0.10.6 spec/graphql/schema/type_expression_spec.rb
graphql-0.10.5 spec/graphql/schema/type_expression_spec.rb
graphql-0.10.4 spec/graphql/schema/type_expression_spec.rb
graphql-0.10.3 spec/graphql/schema/type_expression_spec.rb
graphql-0.10.2 spec/graphql/schema/type_expression_spec.rb
graphql-0.10.1 spec/graphql/schema/type_expression_spec.rb
graphql-0.10.0 spec/graphql/schema/type_expression_spec.rb