@@ -313,4 +313,49 @@ class FieldExecutionStrategyTests: XCTestCase {
313
313
}
314
314
// XCTAssertEqualWithAccuracy(0.1, result.seconds, accuracy: 0.25)
315
315
}
316
+
317
+ func testConcurrentFieldExecutionStrategyWithSingleField( ) throws {
318
+ let result = try timing ( graphql (
319
+ queryStrategy: ConcurrentFieldExecutionStrategy ( ) ,
320
+ schema: schema,
321
+ request: singleQuery,
322
+ eventLoopGroup: eventLoopGroup
323
+ ) . wait ( ) )
324
+ XCTAssertEqual ( result. value, singleExpected)
325
+ }
326
+
327
+ func testConcurrentFieldExecutionStrategyWithSingleFieldError( ) throws {
328
+ let result = try timing ( graphql (
329
+ queryStrategy: ConcurrentFieldExecutionStrategy ( ) ,
330
+ schema: schema,
331
+ request: singleThrowsQuery,
332
+ eventLoopGroup: eventLoopGroup
333
+ ) . wait ( ) )
334
+ XCTAssertEqual ( result. value, singleThrowsExpected)
335
+ }
336
+
337
+ func testConcurrentFieldExecutionStrategyWithMultipleFields( ) throws {
338
+ let result = try timing ( graphql (
339
+ queryStrategy: ConcurrentFieldExecutionStrategy ( ) ,
340
+ schema: schema,
341
+ request: multiQuery,
342
+ eventLoopGroup: eventLoopGroup
343
+ ) . wait ( ) )
344
+ XCTAssertEqual ( result. value, multiExpected)
345
+ }
346
+
347
+ func testConcurrentFieldExecutionStrategyWithMultipleFieldErrors( ) throws {
348
+ let result = try timing ( graphql (
349
+ queryStrategy: ConcurrentFieldExecutionStrategy ( ) ,
350
+ schema: schema,
351
+ request: multiThrowsQuery,
352
+ eventLoopGroup: eventLoopGroup
353
+ ) . wait ( ) )
354
+ XCTAssertEqual ( result. value. data, multiThrowsExpectedData)
355
+ let resultErrors = result. value. errors
356
+ XCTAssertEqual ( resultErrors. count, multiThrowsExpectedErrors. count)
357
+ for m in multiThrowsExpectedErrors {
358
+ XCTAssertTrue ( resultErrors. contains ( m) , " Expecting result errors to contain \( m) " )
359
+ }
360
+ }
316
361
}
0 commit comments