1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
# frozen_string_literal: true
require "spec_helper"
describe GraphQL::StaticValidation::FragmentTypesExist do
include StaticValidationHelpers
let(:query_string) {"
fragment on Cheese {
id
flavor
}
"}
it "finds non-existent types on fragments" do
assert_equal(1, errors.length)
fragment_def_error = {
"message"=>"Fragment definition has no name",
"locations"=>[{"line"=>2, "column"=>5}],
"path"=>["fragment "],
"extensions"=>{"code"=>"anonymousFragment"}
}
assert_includes(errors, fragment_def_error, "on fragment definitions")
end
end
|