Sha256: 645a1975f5c9b8cd9abd0d62508858eb2ac3bbff749779de976a747f9a609da0

Contents?: true

Size: 870 Bytes

Versions: 9

Compression:

Stored size: 870 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

module InstrumentationSpec
  class SomeInterface < GraphQL::Schema::Interface
    field :neverCalled, String, null: false

    def never_called
      "should never be called"
    end
  end

  class SomeType < GraphQL::Schema::Object
    implements SomeInterface
  end

  class Query < GraphQL::Schema::Object
    field :someField, [SomeInterface], null: true

    def some_field
      nil
    end
  end

  class Schema < GraphQL::Schema
    query Query
    orphan_types [SomeType]
  end
end

describe GraphQL::Schema::Member::Instrumentation do
  describe "resolving nullable interface lists to nil" do
    let(:query) { "query { someField { neverCalled } }"}
    it "returns nil instead of failing" do
      result = InstrumentationSpec::Schema.execute(query)
      assert_nil(result["someField"])
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
graphql-1.8.0.pre10 spec/graphql/schema/instrumentation_spec.rb
graphql-1.8.0.pre9 spec/graphql/schema/instrumentation_spec.rb
graphql-1.8.0.pre8 spec/graphql/schema/instrumentation_spec.rb
graphql-1.8.0.pre7 spec/graphql/schema/instrumentation_spec.rb
graphql-1.8.0.pre6 spec/graphql/schema/instrumentation_spec.rb
graphql-1.8.0.pre5 spec/graphql/schema/instrumentation_spec.rb
graphql-1.8.0.pre4 spec/graphql/schema/instrumentation_spec.rb
graphql-1.8.0.pre3 spec/graphql/schema/instrumentation_spec.rb
graphql-1.8.0.pre2 spec/graphql/schema/instrumentation_spec.rb