Sha256: 1f98ac7acc49c0ef36a0d7112da5504df8dc169a6ded1ae83e13eaee882cadf5
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
require 'spec_helper' describe GraphQL::StaticValidation::FragmentsAreOnCompositeTypes do let(:query_string) {%| query getCheese { cheese(id: 1) { ... on Cheese { source ... on Boolean { something } } ... intFields ... on DairyProduct { name } ... on DairyProductInput { something } } } fragment intFields on Int { something } |} let(:validator) { GraphQL::StaticValidation::Validator.new(schema: DummySchema, rules: [GraphQL::StaticValidation::FragmentsAreOnCompositeTypes]) } let(:query) { GraphQL::Query.new(DummySchema, query_string) } let(:errors) { validator.validate(query) } it 'requires Object/Union/Interface fragment types' do expected = [ { "message"=>"Invalid fragment on type Boolean (must be Union, Interface or Object)", "locations"=>[{"line"=>6, "column"=>11}] }, { "message"=>"Invalid fragment on type DairyProductInput (must be Union, Interface or Object)", "locations"=>[{"line"=>14, "column"=>9}], }, { "message"=>"Invalid fragment on type Int (must be Union, Interface or Object)", "locations"=>[{"line"=>20, "column"=>5}] }, ] assert_equal(expected, errors) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
graphql-0.12.1 | spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb |
graphql-0.12.0 | spec/graphql/static_validation/rules/fragments_are_on_composite_types_spec.rb |