Sha256: e9f552af9a7899f16290037c6e4fc1bf1763b2f9070f973b703cd7bf1cb9bd88

Contents?: true

Size: 901 Bytes

Versions: 14

Compression:

Stored size: 901 Bytes

Contents

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}],
          "fields"=>["query getCheese", "okCheese", "source"],
        }, {
          "message"=>"Directive @moreNonsense is not defined",
          "locations"=>[{"line"=>7, "column"=>18}],
          "fields"=>["query getCheese", "okCheese", "... on Cheese", "flavor"],
        }
      ]
      assert_equal(expected, errors)
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
graphql-1.2.6 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-1.2.5 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-1.2.4 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-1.2.3 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-1.2.2 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-1.2.1 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-1.2.0 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-1.1.0 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-1.0.0 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-0.19.4 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-0.19.3 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-0.19.2 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-0.19.1 spec/graphql/static_validation/rules/directives_are_defined_spec.rb
graphql-0.19.0 spec/graphql/static_validation/rules/directives_are_defined_spec.rb