spec/graphql/schema/warden_spec.rb in graphql-1.7.6 vs spec/graphql/schema/warden_spec.rb in graphql-1.7.7
- old
+ new
@@ -240,12 +240,12 @@
}
}
GRAPHQL
res = MaskHelpers.query_with_mask(query_string, mask)
assert_equal "Query", res["data"]["__schema"]["queryType"]["name"]
- assert_equal nil, res["data"]["__schema"]["mutationType"]
- assert_equal nil, res["data"]["__schema"]["subscriptionType"]
+ assert_nil res["data"]["__schema"]["mutationType"]
+ assert_nil res["data"]["__schema"]["subscriptionType"]
type_names = res["data"]["__schema"]["types"].map { |t| t["name"] }
refute type_names.include?("Mutation")
refute type_names.include?("Subscription")
end
end
@@ -342,11 +342,11 @@
|
res = MaskHelpers.run_query(query_string, only: whitelist)
# It's not visible by name
- assert_equal nil, res["data"]["Phoneme"]
+ assert_nil res["data"]["Phoneme"]
# It's not visible in `__schema`
all_type_names = type_names(res)
assert_equal false, all_type_names.include?("Phoneme")
@@ -421,11 +421,11 @@
}
|
res = MaskHelpers.query_with_mask(query_string, mask)
type = res["data"]["__type"]
- assert_equal nil, type
+ assert_nil type
end
end
end
@@ -541,11 +541,11 @@
}
|
res = MaskHelpers.query_with_mask(query_string, mask)
- assert_equal nil, res["data"]["WithinInput"], "The type isn't accessible by name"
+ assert_nil res["data"]["WithinInput"], "The type isn't accessible by name"
languages_arg_names = res["data"]["Query"]["fields"].find { |f| f["name"] == "languages" }["args"].map { |a| a["name"] }
refute_includes languages_arg_names, "within", "Arguments that point to it are gone"
type_names = res["data"]["__schema"]["types"].map { |t| t["name"] }
@@ -664,11 +664,11 @@
}
it "is additive with query filters" do
query_except = ->(member, ctx) { member.metadata[:hidden_input_object_type] }
res = schema.execute(query_str, except: query_except)
- assert_equal nil, res["data"]["input"]
+ assert_nil res["data"]["input"]
enum_values = res["data"]["enum"]["enumValues"].map { |v| v["name"] }
refute_includes enum_values, "TRILL"
end
end
@@ -693,28 +693,28 @@
res = MaskHelpers.run_query(
query_str,
only: [visible_enum_value, visible_abstract_type],
except: [hidden_input_object, hidden_type],
)
- assert_equal nil, res["data"]["input"]
+ assert_nil res["data"]["input"]
enum_values = res["data"]["enum"]["enumValues"].map { |v| v["name"] }
assert_equal 5, enum_values.length
refute_includes enum_values, "TRILL"
# These are also filtered out:
assert_equal 0, res["data"]["abstractType"]["interfaces"].length
- assert_equal nil, res["data"]["type"]
+ assert_nil res["data"]["type"]
end
end
describe "adding filters in instrumentation" do
it "applies only/except filters" do
filters = {
only: visible_enum_value,
except: hidden_input_object,
}
res = MaskHelpers.run_query(query_str, context: { filters: filters })
- assert_equal nil, res["data"]["input"]
+ assert_nil res["data"]["input"]
enum_values = res["data"]["enum"]["enumValues"].map { |v| v["name"] }
assert_equal 5, enum_values.length
refute_includes enum_values, "TRILL"
# These are unaffected:
assert_includes res["data"]["abstractType"]["interfaces"].map { |i| i["name"] }, "LanguageMember"
@@ -725,16 +725,16 @@
filters = {
only: [visible_enum_value, visible_abstract_type],
except: [hidden_input_object, hidden_type],
}
res = MaskHelpers.run_query(query_str, context: { filters: filters })
- assert_equal nil, res["data"]["input"]
+ assert_nil res["data"]["input"]
enum_values = res["data"]["enum"]["enumValues"].map { |v| v["name"] }
assert_equal 5, enum_values.length
refute_includes enum_values, "TRILL"
# These are also filtered out:
assert_equal 0, res["data"]["abstractType"]["interfaces"].length
- assert_equal nil, res["data"]["type"]
+ assert_nil res["data"]["type"]
end
end
end
end