@@ -6,16 +6,24 @@ class ValidationTestCase: XCTestCase {
66
77 var rule : Rule !
88
9- private func validate( body request: String ) throws -> [ GraphQLError ] {
9+ private func validate(
10+ body request: String ,
11+ schema: GraphQLSchema = ValidationExampleSchema
12+ ) throws -> [ GraphQLError ] {
1013 return try GraphQL . validate (
11- schema: ValidationExampleSchema ,
14+ schema: schema ,
1215 ast: parse ( source: Source ( body: request, name: " GraphQL request " ) ) ,
1316 rules: [ rule]
1417 )
1518 }
1619
17- func assertValid( _ query: String , file: StaticString = #file, line: UInt = #line) throws {
18- let errors = try validate ( body: query)
20+ func assertValid(
21+ _ query: String ,
22+ schema: GraphQLSchema = ValidationExampleSchema,
23+ file: StaticString = #file,
24+ line: UInt = #line
25+ ) throws {
26+ let errors = try validate ( body: query, schema: schema)
1927 XCTAssertEqual (
2028 errors. count,
2129 0 ,
@@ -28,10 +36,11 @@ class ValidationTestCase: XCTestCase {
2836 @discardableResult func assertInvalid(
2937 errorCount: Int ,
3038 query: String ,
39+ schema: GraphQLSchema = ValidationExampleSchema,
3140 file: StaticString = #file,
3241 line: UInt = #line
3342 ) throws -> [ GraphQLError ] {
34- let errors = try validate ( body: query)
43+ let errors = try validate ( body: query, schema : schema )
3544 XCTAssertEqual (
3645 errors. count,
3746 errorCount,
0 commit comments