Sha256: 100cbc9dc675a2fe2a75aa85de4de8817375c96ea40ea1a06b25a2d9ca4d9954
Contents?: true
Size: 1.25 KB
Versions: 7
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true require "spec_helper" describe GraphQL::StaticValidation::VariablesAreInputTypes do include StaticValidationHelpers let(:query_string) {' query getCheese( $id: Int = 1, $str: [String!], $interface: AnimalProduct!, $object: Milk = 1, $objects: [Cheese]!, $unknownType: Nonsense, ) { cheese(id: $id) { source } __type(name: $str) { name } } '} it "finds variables whose types are invalid" do assert_includes(errors, { "message"=>"AnimalProduct isn't a valid input type (on $interface)", "locations"=>[{"line"=>5, "column"=>7}], "fields"=>["query getCheese"], }) assert_includes(errors, { "message"=>"Milk isn't a valid input type (on $object)", "locations"=>[{"line"=>6, "column"=>7}], "fields"=>["query getCheese"], }) assert_includes(errors, { "message"=>"Cheese isn't a valid input type (on $objects)", "locations"=>[{"line"=>7, "column"=>7}], "fields"=>["query getCheese"], }) assert_includes(errors, { "message"=>"Nonsense isn't a defined input type (on $unknownType)", "locations"=>[{"line"=>8, "column"=>7}], "fields"=>["query getCheese"], }) end end
Version data entries
7 entries across 7 versions & 1 rubygems