Skip to content

Commit

Permalink
Merge pull request #3451 from Shopify/fix-invalid-default
Browse files Browse the repository at this point in the history
Fix test with invalid default value
  • Loading branch information
Robert Mosolgo authored Apr 27, 2021
2 parents dcaddc8 + e13004a commit 8c981e7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spec/graphql/schema/input_object_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion spec/support/jazz.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 8c981e7

Please sign in to comment.