@@ -6,16 +6,24 @@ class ValidationTestCase: XCTestCase {
6
6
7
7
var rule : Rule !
8
8
9
- private func validate( body request: String ) throws -> [ GraphQLError ] {
9
+ private func validate(
10
+ body request: String ,
11
+ schema: GraphQLSchema = ValidationExampleSchema
12
+ ) throws -> [ GraphQLError ] {
10
13
return try GraphQL . validate (
11
- schema: ValidationExampleSchema ,
14
+ schema: schema ,
12
15
ast: parse ( source: Source ( body: request, name: " GraphQL request " ) ) ,
13
16
rules: [ rule]
14
17
)
15
18
}
16
19
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)
19
27
XCTAssertEqual (
20
28
errors. count,
21
29
0 ,
@@ -28,10 +36,11 @@ class ValidationTestCase: XCTestCase {
28
36
@discardableResult func assertInvalid(
29
37
errorCount: Int ,
30
38
query: String ,
39
+ schema: GraphQLSchema = ValidationExampleSchema,
31
40
file: StaticString = #file,
32
41
line: UInt = #line
33
42
) throws -> [ GraphQLError ] {
34
- let errors = try validate ( body: query)
43
+ let errors = try validate ( body: query, schema : schema )
35
44
XCTAssertEqual (
36
45
errors. count,
37
46
errorCount,
0 commit comments