Sha256: 6794e7db869889c10a7a38a5e4ebbd547a825d3a837de60acdb41d2c95b1b6cd

Contents?: true

Size: 1.06 KB

Versions: 34

Compression:

Stored size: 1.06 KB

Contents

require "spec_helper"

describe GraphQL::Schema::TypeExpression do
  let(:schema) { DummySchema }
  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(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_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 = DairyAnimalEnum
          .to_non_null_type
          .to_list_type
          .to_non_null_type
        assert_equal(expected, type_expression_result)
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
graphql-1.0.0 spec/graphql/schema/type_expression_spec.rb
graphql-0.19.4 spec/graphql/schema/type_expression_spec.rb
graphql-0.19.3 spec/graphql/schema/type_expression_spec.rb
graphql-0.19.2 spec/graphql/schema/type_expression_spec.rb
graphql-0.19.1 spec/graphql/schema/type_expression_spec.rb
graphql-0.19.0 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.15 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.14 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.13 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.12 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.11 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.10 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.9 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.8 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.7 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.6 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.5 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.4 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.3 spec/graphql/schema/type_expression_spec.rb
graphql-0.18.2 spec/graphql/schema/type_expression_spec.rb