Sha256: 9c1c98a8431e146a3be28702e8f58214cd477e8a3b98011a9e3f90f07699606e

Contents?: true

Size: 869 Bytes

Versions: 15

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::StaticValidation::SubscriptionRootExists do
  include StaticValidationHelpers

  let(:query_string) {%|
    subscription {
      test
    }
  |}

  let(:schema) {
    query_root = GraphQL::ObjectType.define do
      name "Query"
      description "Query root of the system"
    end

    GraphQL::Schema.define do
      query query_root
    end
  }

  it "errors when a subscription is performed on a schema without a subscription root" do
    assert_equal(1, errors.length)
    missing_subscription_root_error = {
      "message"=>"Schema is not configured for subscriptions",
      "locations"=>[{"line"=>2, "column"=>5}],
      "path"=>["subscription"],
      "extensions"=>{"code"=>"missingSubscriptionConfiguration"}
    }
    assert_includes(errors, missing_subscription_root_error)
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
graphql-1.9.11 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.10 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.9 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.8 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.7 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.6 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.5 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.4 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.3 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.2 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.1 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.0 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.0.pre4 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.0.pre3 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb
graphql-1.9.0.pre2 spec/graphql/static_validation/rules/subscription_root_exists_spec.rb