Sha256: e6888f85897dd519c5d15c958c6f9e636a85ad99067d2b1057f358140482811e

Contents?: true

Size: 1.09 KB

Versions: 6

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true
require "spec_helper"

describe GraphQL::Schema::InputObject do
  let(:input_object) { Jazz::EnsembleInput }
  describe "type info" do
    it "has it" do
      assert_equal "EnsembleInput", input_object.graphql_name
      assert_equal nil, input_object.description
      assert_equal 1, input_object.arguments.size
    end
  end

  describe ".to_graphql" do
    it "assigns itself as the arguments_class" do
      assert_equal input_object, input_object.to_graphql.arguments_class
    end
  end

  describe "in queries" do
    it "is passed to the field method" do
      query_str = <<-GRAPHQL
      {
        inspectInput(input: {
          stringValue: "ABC",
          legacyInput: { intValue: 4 },
          nestedInput: { stringValue: "xyz"}
        })
      }
      GRAPHQL

      res = Jazz::Schema.execute(query_str, context: { message: "hi" })
      expected_info = [
        "Jazz::InspectableInput",
        "hi, ABC, 4, (hi, xyz, -, (-))",
        "ABC",
        "ABC",
        "ABC",
      ]
      assert_equal expected_info, res["data"]["inspectInput"]
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
graphql-1.8.0.pre6 spec/graphql/schema/input_object_spec.rb
graphql-1.8.0.pre5 spec/graphql/schema/input_object_spec.rb
graphql-1.8.0.pre4 spec/graphql/schema/input_object_spec.rb
graphql-1.8.0.pre3 spec/graphql/schema/input_object_spec.rb
graphql-1.8.0.pre2 spec/graphql/schema/input_object_spec.rb
graphql-1.8.0.pre1 spec/graphql/schema/input_object_spec.rb