Skip to content

Commit 73ea1d9

Browse files
committed
Add a test
1 parent 13fbbc8 commit 73ea1d9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Tests/OpenAPIRuntimeTests/Interface/Test_UniversalClient.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,26 @@ final class Test_UniversalClient: Test_Runtime {
119119
}
120120
}
121121

122+
func testErrorPropagation_customErrorMapper() async throws {
123+
do {
124+
let client = UniversalClient(
125+
transport: MockClientTransport.failing,
126+
errorMapper: { clientError in
127+
// Don't care about the extra context, just wants the underlyingError
128+
clientError.underlyingError
129+
}
130+
)
131+
try await client.send(
132+
input: "input",
133+
forOperation: "op",
134+
serializer: { input in (HTTPRequest(soar_path: "/", method: .post), MockClientTransport.requestBody) },
135+
deserializer: { response, body in fatalError() }
136+
)
137+
} catch {
138+
XCTAssertTrue(error is TestError, "Threw an unexpected error: \(type(of: error))")
139+
}
140+
}
141+
122142
func testErrorPropagation_middlewareOnResponse() async throws {
123143
do {
124144
let client = UniversalClient(

0 commit comments

Comments
 (0)