From e13004a492fc24b602974517590ca7a095aae459 Mon Sep 17 00:00:00 2001 From: Evan Huus Date: Tue, 27 Apr 2021 20:33:39 +0000 Subject: [PATCH] Fix test with invalid default value InspectableInput has a required argument, so this test was technically invalid. I discovered this while trying to add validation for default values. Replace it with a new fully optional input type in this test. --- spec/graphql/schema/input_object_spec.rb | 2 +- spec/support/jazz.rb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/graphql/schema/input_object_spec.rb b/spec/graphql/schema/input_object_spec.rb index a85b0fb80e..35eec220f1 100644 --- a/spec/graphql/schema/input_object_spec.rb +++ b/spec/graphql/schema/input_object_spec.rb @@ -487,7 +487,7 @@ def self.resolve_type(type, obj, ctx) it "works with empty objects" do res = Jazz::Schema.execute("{ defaultValueTest2 }") - assert_equal "Jazz::InspectableInput -> {}", res["data"]["defaultValueTest2"] + assert_equal "Jazz::FullyOptionalInput -> {}", res["data"]["defaultValueTest2"] end it "introspects in GraphQL language with enums" do diff --git a/spec/support/jazz.rb b/spec/support/jazz.rb index 40c9c7d743..7b4c011acf 100644 --- a/spec/support/jazz.rb +++ b/spec/support/jazz.rb @@ -335,6 +335,10 @@ class LegacyInputType < GraphQL::Schema::InputObject argument :int_value, Int, required: true end + class FullyOptionalInput < GraphQL::Schema::InputObject + argument :optional_value, String, required: false + end + class InspectableInput < GraphQL::Schema::InputObject argument :ensemble_id, ID, required: false, loads: Ensemble argument :string_value, String, required: true, description: "Test description kwarg" @@ -547,7 +551,7 @@ def default_value_test(arg_with_default:) end field :default_value_test_2, String, null: false, resolver_method: :default_value_test do - argument :arg_with_default, InspectableInput, required: false, default_value: {} + argument :arg_with_default, FullyOptionalInput, required: false, default_value: {} end field :complex_hash_key, String, null: false, hash_key: :'foo bar/fizz-buzz'