Sha256: 850895c8555419db8eff254aceb7ed5f090df80b94de92d5411ed00e2b209d4a

Contents?: true

Size: 842 Bytes

Versions: 29

Compression:

Stored size: 842 Bytes

Contents

require "spec_helper"

describe GraphQL::BaseType do
  it "becomes non-null with !" do
    type = GraphQL::EnumType.new
    non_null_type = !type
    assert_equal(GraphQL::TypeKinds::NON_NULL, non_null_type.kind)
    assert_equal(type, non_null_type.of_type)
    assert_equal(GraphQL::TypeKinds::NON_NULL, (!GraphQL::STRING_TYPE).kind)
  end

  it "can be compared" do
    assert_equal(!GraphQL::INT_TYPE, !GraphQL::INT_TYPE)
    refute_equal(!GraphQL::FLOAT_TYPE, GraphQL::FLOAT_TYPE)
    assert_equal(
      GraphQL::ListType.new(of_type: MilkType),
      GraphQL::ListType.new(of_type: MilkType)
    )
    refute_equal(
      GraphQL::ListType.new(of_type: MilkType),
      GraphQL::ListType.new(of_type: !MilkType)
    )
  end

  it "Accepts arbitrary metadata" do
    assert_equal ["Cheese"], CheeseType.metadata[:class_names]
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
graphql-1.2.6 spec/graphql/base_type_spec.rb
graphql-1.2.5 spec/graphql/base_type_spec.rb
graphql-1.2.4 spec/graphql/base_type_spec.rb
graphql-1.2.3 spec/graphql/base_type_spec.rb
graphql-1.2.2 spec/graphql/base_type_spec.rb
graphql-1.2.1 spec/graphql/base_type_spec.rb
graphql-1.2.0 spec/graphql/base_type_spec.rb
graphql-1.1.0 spec/graphql/base_type_spec.rb
graphql-1.0.0 spec/graphql/base_type_spec.rb
graphql-0.19.4 spec/graphql/base_type_spec.rb
graphql-0.19.3 spec/graphql/base_type_spec.rb
graphql-0.19.2 spec/graphql/base_type_spec.rb
graphql-0.19.1 spec/graphql/base_type_spec.rb
graphql-0.19.0 spec/graphql/base_type_spec.rb
graphql-0.18.15 spec/graphql/base_type_spec.rb
graphql-0.18.14 spec/graphql/base_type_spec.rb
graphql-0.18.13 spec/graphql/base_type_spec.rb
graphql-0.18.12 spec/graphql/base_type_spec.rb
graphql-0.18.11 spec/graphql/base_type_spec.rb
graphql-0.18.10 spec/graphql/base_type_spec.rb