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