Sha256: 68d6eb455e6ff71ccf04af473dc6f3b356557ecc0ea4f48e2bffebc311ed357c
Contents?: true
Size: 1.01 KB
Versions: 26
Compression:
Stored size: 1.01 KB
Contents
require 'spec_helper' describe GraphQL::StaticValidation::FragmentsAreFinite do let(:document) { GraphQL.parse(%| query getCheese { cheese(id: 1) { ... idField ... sourceField ... flavorField } } fragment sourceField on Cheese { source, ... flavorField ... idField } fragment flavorField on Cheese { flavor, ... sourceField } fragment idField on Cheese { id } |)} let(:validator) { GraphQL::StaticValidation::Validator.new(schema: DummySchema, rules: [GraphQL::StaticValidation::FragmentsAreFinite]) } let(:errors) { validator.validate(document) } it 'doesnt allow infinite loops' do expected = [ { "message"=>"Fragment sourceField contains an infinite loop", "locations"=>[{"line"=>10, "column"=>5}] }, { "message"=>"Fragment flavorField contains an infinite loop", "locations"=>[{"line"=>15, "column"=>5}] } ] assert_equal(expected, errors) end end
Version data entries
26 entries across 26 versions & 1 rubygems