Sha256: 3a6da6ccc6ebac242f8d1b2ae0f1d5efb0a4597af3403bb31164c7d563081d84

Contents?: true

Size: 1.07 KB

Versions: 15

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::StaticValidation::DirectivesAreDefined do
  include StaticValidationHelpers
  let(:query_string) {"
    query getCheese {
      okCheese: cheese(id: 1) {
        id @skip(if: true),
        source @nonsense(if: false)
        ... on Cheese {
          flavor @moreNonsense
        }
      }
    }
  "}
  describe "non-existent directives" do
    it "makes errors for them" do
      expected = [
        {
          "message"=>"Directive @nonsense is not defined",
          "locations"=>[{"line"=>5, "column"=>16}],
          "path"=>["query getCheese", "okCheese", "source"],
          "extensions"=>{"code"=>"undefinedDirective", "directiveName"=>"nonsense"}
        }, {
          "message"=>"Directive @moreNonsense is not defined",
          "locations"=>[{"line"=>7, "column"=>18}],
          "path"=>["query getCheese", "okCheese", "... on Cheese", "flavor"],
          "extensions"=>{"code"=>"undefinedDirective", "directiveName"=>"moreNonsense"}
        }
      ]
      assert_equal(expected, errors)
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

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