Skip to content

Commit 8c981e7

Browse files
author
Robert Mosolgo
authored
Merge pull request #3451 from Shopify/fix-invalid-default
Fix test with invalid default value
2 parents dcaddc8 + e13004a commit 8c981e7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

spec/graphql/schema/input_object_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ def self.resolve_type(type, obj, ctx)
487487

488488
it "works with empty objects" do
489489
res = Jazz::Schema.execute("{ defaultValueTest2 }")
490-
assert_equal "Jazz::InspectableInput -> {}", res["data"]["defaultValueTest2"]
490+
assert_equal "Jazz::FullyOptionalInput -> {}", res["data"]["defaultValueTest2"]
491491
end
492492

493493
it "introspects in GraphQL language with enums" do

spec/support/jazz.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@ class LegacyInputType < GraphQL::Schema::InputObject
335335
argument :int_value, Int, required: true
336336
end
337337

338+
class FullyOptionalInput < GraphQL::Schema::InputObject
339+
argument :optional_value, String, required: false
340+
end
341+
338342
class InspectableInput < GraphQL::Schema::InputObject
339343
argument :ensemble_id, ID, required: false, loads: Ensemble
340344
argument :string_value, String, required: true, description: "Test description kwarg"
@@ -547,7 +551,7 @@ def default_value_test(arg_with_default:)
547551
end
548552

549553
field :default_value_test_2, String, null: false, resolver_method: :default_value_test do
550-
argument :arg_with_default, InspectableInput, required: false, default_value: {}
554+
argument :arg_with_default, FullyOptionalInput, required: false, default_value: {}
551555
end
552556

553557
field :complex_hash_key, String, null: false, hash_key: :'foo bar/fizz-buzz'

0 commit comments

Comments
 (0)