@@ -154,12 +154,12 @@ final class ConversationTests: XCTestCase {
154154
155155 let options = makeOptions ( )
156156
157- await XCTAssertThrowsErrorAsync (
158- try conversation. startConversation (
157+ await XCTAssertThrowsErrorAsync {
158+ try await conversation. startConversation (
159159 auth: . publicAgent( id: " test-agent " ) ,
160- options: options,
161- ) ,
162- ) { error in
160+ options: options
161+ )
162+ } errorHandler : { error in
163163 XCTAssertEqual ( error as? ConversationError , . authenticationFailed( " Mock authentication failed " ) )
164164 }
165165
@@ -179,12 +179,12 @@ final class ConversationTests: XCTestCase {
179179
180180 let options = makeOptions ( )
181181
182- await XCTAssertThrowsErrorAsync (
183- try conversation. startConversation (
182+ await XCTAssertThrowsErrorAsync {
183+ try await conversation. startConversation (
184184 auth: . publicAgent( id: " test-agent " ) ,
185- options: options,
186- ) ,
187- ) { error in
185+ options: options
186+ )
187+ } errorHandler : { error in
188188 XCTAssertEqual ( error as? ConversationError , . connectionFailed( " Mock connection failed " ) )
189189 }
190190
@@ -218,7 +218,9 @@ final class ConversationTests: XCTestCase {
218218 await Task . yield ( )
219219 mockConnectionManager. timeoutAgentReady ( )
220220
221- await XCTAssertThrowsErrorAsync ( try startTask. value) { error in
221+ await XCTAssertThrowsErrorAsync {
222+ try await startTask. value
223+ } errorHandler: { error in
222224 XCTAssertEqual ( error as? ConversationError , . agentTimeout)
223225 }
224226
@@ -265,12 +267,12 @@ final class ConversationTests: XCTestCase {
265267
266268 let options = makeOptions ( )
267269
268- await XCTAssertThrowsErrorAsync (
269- try conversation. startConversation (
270+ await XCTAssertThrowsErrorAsync {
271+ try await conversation. startConversation (
270272 auth: . publicAgent( id: " test-agent " ) ,
271- options: options,
272- ) ,
273- ) { error in
273+ options: options
274+ )
275+ } errorHandler : { error in
274276 XCTAssertEqual ( error as? ConversationError , . connectionFailed( " Publish failed " ) )
275277 }
276278
@@ -428,12 +430,12 @@ final class ConversationTests: XCTestCase {
428430
429431@MainActor
430432private extension XCTestCase {
431- func XCTAssertThrowsErrorAsync(
432- _ expression: @autoclosure ( ) async throws -> some Any ,
433+ func XCTAssertThrowsErrorAsync< T > (
434+ _ expression: ( ) async throws -> T ,
433435 _ message: @autoclosure ( ) -> String = " " ,
434436 file: StaticString = #filePath,
435437 line: UInt = #line,
436- _ errorHandler: ( Error ) -> Void = { _ in } ,
438+ _ errorHandler: ( Error ) -> Void = { _ in }
437439 ) async {
438440 do {
439441 _ = try await expression ( )
0 commit comments