Skip to content

Commit 3ddb1b9

Browse files
committed
Adopt Swift Testing in test WebSockets test case
1 parent a050d03 commit 3ddb1b9

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Tests/AWSLambdaEventsTests/APIGateway+WebsocketsTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import XCTest
15+
import Foundation
16+
import Testing
1617

1718
@testable import AWSLambdaEvents
1819

19-
class APIGatewayWebSocketsTests: XCTestCase {
20+
@Suite
21+
class APIGatewayWebSocketsTests {
2022
static let exampleConnectEventBody = """
2123
{
2224
"headers": {
@@ -65,14 +67,12 @@ class APIGatewayWebSocketsTests: XCTestCase {
6567
// MARK: - Request -
6668

6769
// MARK: Decoding
68-
69-
func testRequestDecodingExampleConnectRequest() {
70+
@Test func testRequestDecodingExampleConnectRequest() async throws {
7071
let data = APIGatewayWebSocketsTests.exampleConnectEventBody.data(using: .utf8)!
71-
var req: APIGatewayWebSocketRequest?
72-
XCTAssertNoThrow(req = try JSONDecoder().decode(APIGatewayWebSocketRequest.self, from: data))
72+
let req = try JSONDecoder().decode(APIGatewayWebSocketRequest.self, from: data)
7373

74-
XCTAssertEqual(req?.context.routeKey, "$connect")
75-
XCTAssertEqual(req?.context.connectionId, "IU3kkeN4IAMCJwA=")
76-
XCTAssertNil(req?.body)
74+
#expect(req.context.routeKey == "$connect")
75+
#expect(req.context.connectionId == "IU3kkeN4IAMCJwA=")
76+
#expect(req.body == nil)
7777
}
7878
}

0 commit comments

Comments
 (0)