Sha256: 763bbb1dd1c7c13f3186cf73696f0b3d98f3e7f6422c5ccb37a44147abdf5a72
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
require "integration_spec_helper" RSpec.describe NulogyMessageBusProducer::SubscriberGraphqlSchemaValidator do subject(:validator) { NulogyMessageBusProducer::SubscriberGraphqlSchemaValidator.new } describe "#validate" do context "when a valid query is present" do it "return true" do create_subscription(query: <<~GRAPHQL) query ($id: UUID!) { foo (id: $id) { id } } GRAPHQL expect(validator.validate).to be(true) end end context "when an invalid query is present" do let(:subscription_with_error) do subscription = create_subscription(query: <<~GRAPHQL) query ($id: UUID!) { foo (id: $id) { id } } GRAPHQL subscription.query = <<~GRAPHQL query ($id: UUID!) { foo (id: $id) { a_field_that_does_not_exist } } GRAPHQL subscription.save(validate: false) subscription end it "returns false" do subscription_with_error expect(validator.validate).to be(false) end it "has errors" do subscription_with_error validator.validate expect(validator.errors).to contain_exactly( "Field 'a_field_that_does_not_exist' doesn't exist on type 'testObject' (id: #{subscription_with_error.id})" ) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nulogy_message_bus_producer-2.1.1 | spec/integration/lib/nulogy_message_bus_producer/subscriber_graphql_schema_validator_spec.rb |