Sha256: a196c562288bf2f5529880a8147ba413971333906e265aff3ddd3d5b3b400d06

Contents?: true

Size: 1.23 KB

Versions: 28

Compression:

Stored size: 1.23 KB

Contents

# frozen_string_literal: true

require "spec_helper"

describe GraphQL::Schema::NonNull do
  let(:of_type) { Jazz::Musician }
  let(:non_null_type) { GraphQL::Schema::NonNull.new(of_type) }

  it "returns list? to be false" do
    refute non_null_type.list?
  end

  it "returns non_null? to be true" do
    assert non_null_type.non_null?
  end

  it "returns kind to be GraphQL::TypeKinds::NON_NULL" do
    assert_equal GraphQL::TypeKinds::NON_NULL, non_null_type.kind
  end

  it "returns correct type signature" do
    assert_equal "Musician!", non_null_type.to_type_signature
  end

  describe "comparison operator" do
    it "will return false if list types 'of_type' are different" do
      new_of_type = Jazz::InspectableKey
      new_non_null_type = GraphQL::Schema::NonNull.new(new_of_type)

      refute_equal non_null_type, new_non_null_type
    end

    it "will return true if list types 'of_type' are the same" do
      new_of_type = Jazz::Musician
      new_non_null_type = GraphQL::Schema::NonNull.new(new_of_type)
      
      assert_equal non_null_type, new_non_null_type
    end
  end

  describe "to_graphql" do
    it "will return a non null type" do
      assert_kind_of GraphQL::NonNullType, non_null_type.to_graphql
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

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