Skip to content

Commit 4c19e2d

Browse files
committed
fix test
1 parent 5b740f3 commit 4c19e2d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Tests/FunctionsTests/FunctionsClientTests.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class FunctionsClientTests: XCTestCase {
2525
XCTAssertEqual(client.region, "sa-east-1")
2626

2727
XCTAssertEqual(client.headers[.init("Apikey")!], apiKey)
28-
XCTAssertNotNil(client.headers[.init("X-Client-Info")!])
28+
XCTAssertNotNil(client.headers[.xClientInfo])
2929
}
3030

3131
func testInvoke() async throws {
@@ -49,17 +49,21 @@ final class FunctionsClientTests: XCTestCase {
4949

5050
try await sut.invoke(
5151
"hello_world",
52-
options: .init(headers: ["X-Custom-Key": "value"], body: body)
52+
options: .init(
53+
headers: ["X-Custom-Key": "value"],
54+
body: body
55+
)
5356
)
5457

55-
guard let request = await http.receivedRequests.last else { return }
56-
58+
let _request = await http.receivedRequests.last
59+
let request = try XCTUnwrap(_request)
60+
5761
XCTAssertEqual(request.request.url, url)
5862
XCTAssertEqual(request.request.method, .post)
5963
XCTAssertEqual(request.request.headerFields[.init("Apikey")!], apiKey)
6064
XCTAssertEqual(request.request.headerFields[.init("X-Custom-Key")!], "value")
6165
XCTAssertEqual(
62-
request.request.headerFields[.init("X-Client-Info")!],
66+
request.request.headerFields[.xClientInfo],
6367
"functions-swift/\(Functions.version)"
6468
)
6569
}

0 commit comments

Comments
 (0)