Sha256: 6c173b65c2f45b55de5940e5b3faafe4a87a10b9863e0a82065d82e462c79c4f
Contents?: true
Size: 1.16 KB
Versions: 8
Compression:
Stored size: 1.16 KB
Contents
require "spec_helper" describe GraphQL::StaticValidation::DirectivesAreInValidLocations do let(:query_string) {" query getCheese @skip(if: true) { okCheese: cheese(id: 1) { id @skip(if: true), source ... on Cheese @skip(if: true) { flavor } } } fragment whatever on Cheese @skip(if: true) { id } "} let(:validator) { GraphQL::StaticValidation::Validator.new(schema: DummySchema, rules: [GraphQL::StaticValidation::DirectivesAreInValidLocations]) } let(:query) { GraphQL::Query.new(DummySchema, query_string) } let(:errors) { validator.validate(query) } describe "invalid directive locations" do it "makes errors for them" do expected = [ { "message"=> "'@skip' can't be applied to queries (allowed: fields, fragment spreads, inline fragments)", "locations"=>[{"line"=>2, "column"=>21}] }, { "message"=>"'@skip' can't be applied to fragment definitions (allowed: fields, fragment spreads, inline fragments)", "locations"=>[{"line"=>12, "column"=>33}] }, ] assert_equal(expected, errors) end end end
Version data entries
8 entries across 8 versions & 1 rubygems