Sha256: 6326ffd8757e804f3ea339461979510c14e6885188b9bb43cd36fb3141ee9c50

Contents?: true

Size: 797 Bytes

Versions: 23

Compression:

Stored size: 797 Bytes

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::Language::Generation do
  describe "#to_query_tring" do
    let(:document) {
      GraphQL.parse('type Query { a: String! }')
    }

    class CustomPrinter < GraphQL::Language::Printer
      def print_field_definition(print_field_definition)
        "<Field Hidden>"
      end
    end

    it "accepts a custom printer" do
      expected = <<-SCHEMA
type Query {
  a: String!
}
      SCHEMA

      assert_equal expected.chomp, GraphQL::Language::Generation.generate(document)
    end

    it "accepts a custom printer" do
      expected = <<-SCHEMA
type Query {
  <Field Hidden>
}
      SCHEMA

      assert_equal expected.chomp, GraphQL::Language::Generation.generate(document, printer: CustomPrinter.new)
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
graphql-1.8.6 spec/graphql/language/generation_spec.rb
graphql-1.8.5 spec/graphql/language/generation_spec.rb
graphql-1.8.4 spec/graphql/language/generation_spec.rb
graphql-1.8.3 spec/graphql/language/generation_spec.rb
graphql-1.8.2 spec/graphql/language/generation_spec.rb
graphql-1.8.1 spec/graphql/language/generation_spec.rb
graphql-1.8.0 spec/graphql/language/generation_spec.rb
graphql-1.8.0.pre11 spec/graphql/language/generation_spec.rb
graphql-1.8.0.pre10 spec/graphql/language/generation_spec.rb
graphql-1.7.14 spec/graphql/language/generation_spec.rb
graphql-1.8.0.pre9 spec/graphql/language/generation_spec.rb
graphql-1.8.0.pre8 spec/graphql/language/generation_spec.rb
graphql-1.7.13 spec/graphql/language/generation_spec.rb
graphql-1.8.0.pre7 spec/graphql/language/generation_spec.rb
graphql-1.7.12 spec/graphql/language/generation_spec.rb
graphql-1.7.11 spec/graphql/language/generation_spec.rb
graphql-1.7.10 spec/graphql/language/generation_spec.rb
graphql-1.8.0.pre6 spec/graphql/language/generation_spec.rb
graphql-1.8.0.pre5 spec/graphql/language/generation_spec.rb
graphql-1.7.9 spec/graphql/language/generation_spec.rb