Sha256: bd43034d39877353909232b3a770ac0428f8ac45a15f701f3cfe3287878a2de3

Contents?: true

Size: 711 Bytes

Versions: 15

Compression:

Stored size: 711 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::StaticValidation::FragmentNamesAreUnique do
  include StaticValidationHelpers

  let(:query_string) {"
    query {
      cheese(id: 1) {
        ... frag1
      }
    }

    fragment frag1 on Cheese { id }
    fragment frag1 on Cheese { id }
  "}

  it "requires unique fragment names" do
    assert_equal(1, errors.length)
    fragment_def_error = {
      "message"=>"Fragment name \"frag1\" must be unique",
      "locations"=>[{"line"=>8, "column"=>5}, {"line"=>9, "column"=>5}],
      "path"=>[],
      "extensions"=>{"code"=>"fragmentNotUnique", "fragmentName"=>"frag1"}
    }
    assert_includes(errors, fragment_def_error)
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
graphql-1.9.11 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.10 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.9 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.8 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.7 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.6 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.5 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.4 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.3 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.2 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.1 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.0 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.0.pre4 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.0.pre3 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb
graphql-1.9.0.pre2 spec/graphql/static_validation/rules/fragment_names_are_unique_spec.rb