Sha256: 38fe9b1309d4bad28084f177d77444045a46b66c318bc612a688ac7e49f0c20f
Contents?: true
Size: 1.26 KB
Versions: 15
Compression:
Stored size: 1.26 KB
Contents
# frozen_string_literal: true require "spec_helper" describe GraphQL::StaticValidation::ArgumentNamesAreUnique do include StaticValidationHelpers describe "field arguments" do let(:query_string) { <<-GRAPHQL query GetStuff { c1: cheese(id: 1, id: 2) { flavor } c2: cheese(id: 2) { flavor } } GRAPHQL } it "finds duplicate names" do assert_equal 1, errors.size error = errors.first assert_equal 'There can be only one argument named "id"', error["message"] assert_equal [{ "line" => 2, "column" => 18}, { "line" => 2, "column" => 25 }], error["locations"] assert_equal ["query GetStuff", "c1"], error["path"] end end describe "directive arguments" do let(:query_string) { <<-GRAPHQL query GetStuff { c1: cheese(id: 1) @include(if: true, if: true) { flavor } c2: cheese(id: 2) @include(if: true) { flavor } } GRAPHQL } it "finds duplicate names" do assert_equal 1, errors.size error = errors.first assert_equal 'There can be only one argument named "if"', error["message"] assert_equal [{ "line" => 2, "column" => 34}, { "line" => 2, "column" => 44 }], error["locations"] assert_equal ["query GetStuff", "c1"], error["path"] end end end
Version data entries
15 entries across 15 versions & 1 rubygems