Sha256: 71dd8e7bfc5bab2214ecc3e277cd9dd1dbaecdb1548052c16ad26a4b3484a7b4
Contents?: true
Size: 987 Bytes
Versions: 3
Compression:
Stored size: 987 Bytes
Contents
require "spec_helper" describe GraphQL::StaticValidation::SubscriptionRootExists do let(:query_string) {%| subscription { test } |} let(:schema) { query_root = GraphQL::Field.define do name "Query" description "Query root of the system" end GraphQL::Schema.define do query query_root end } let(:validator) { GraphQL::StaticValidation::Validator.new(schema: schema, rules: [GraphQL::StaticValidation::SubscriptionRootExists]) } let(:query) { GraphQL::Query.new(schema, query_string) } let(:errors) { validator.validate(query)[:errors] } 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"], } assert_includes(errors, missing_subscription_root_error) end end
Version data entries
3 entries across 3 versions & 1 rubygems