File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -85,17 +85,24 @@ final class DataLoaderAsyncTests: XCTestCase {
85
85
return await task. value
86
86
}
87
87
88
- async let value1 = identityLoader. load ( key: 1 , on: eventLoopGroup)
89
- async let value2 = identityLoader. load ( key: 2 , on: eventLoopGroup)
88
+ // Normally async-let is a better option that using explicit Task, but the test machine fails to use async let multiple times already
89
+ // async let value1 = identityLoader.load(key: 1, on: eventLoopGroup)
90
+ // async let value2 = identityLoader.load(key: 2, on: eventLoopGroup)
91
+ let value1 = Task {
92
+ try await identityLoader. load ( key: 1 , on: eventLoopGroup)
93
+ }
94
+ let value2 = Task {
95
+ try await identityLoader. load ( key: 2 , on: eventLoopGroup)
96
+ }
90
97
91
98
/// Have to wait for a split second because Tasks may not be executed before this statement
92
99
try await Task . sleep ( nanoseconds: 500_000_000 )
93
100
94
101
XCTAssertNoThrow ( try identityLoader. execute ( ) )
95
102
96
- let result1 = try await value1
103
+ let result1 = try await value1. value
97
104
XCTAssertEqual ( result1, 1 )
98
- let result2 = try await value2
105
+ let result2 = try await value2. value
99
106
XCTAssertEqual ( result2, 2 )
100
107
101
108
let loadCalls = await LoadCalls . shared. loadCalls
You can’t perform that action at this time.
0 commit comments