Skip to content

Commit 4b9aaab

Browse files
test: Adds test of unhappy path
1 parent 2cc0630 commit 4b9aaab

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Tests/GraphQLTests/ValidationTests/NoUnusedVariablesRuleTests.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,4 +266,20 @@ class NoUnusedVariablesRuleTests: ValidationTestCase {
266266
"""
267267
)
268268
}
269+
270+
func testVariableUnusedInsideObject() throws {
271+
let errors = try assertInvalid(
272+
errorCount: 1,
273+
query: """
274+
query Foo($a: String, $b: String) {
275+
field(object: { a: $a })
276+
}
277+
"""
278+
)
279+
280+
try assertValidationError(
281+
error: errors[0], line: 1, column: 23,
282+
message: #"Variable "$b" is never used in operation "Foo"."#
283+
)
284+
}
269285
}

0 commit comments

Comments
 (0)