Skip to content

Commit

Permalink
Add testCloseTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-fowler committed Dec 18, 2024
1 parent 32091be commit 9b6d0ab
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Tests/HummingbirdWebSocketTests/WebSocketTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,25 @@ final class HummingbirdWebSocketTests: XCTestCase {
}
}

func testCloseTimeout() async throws {
let app = Application(
router: Router(),
server: .http1WebSocketUpgrade { _, _, _ in
.upgrade([:]) { _, _, _ in
try await cancelWhenGracefulShutdown {
try await Task.sleep(for: .seconds(15))
XCTFail("Should not reach here")
}
}
}
)
try await app.test(.live) { client in
_ = try await client.ws("/", configuration: .init(closeTimeout: .seconds(1))) { _, outbound, _ in
try await outbound.write(.text("Hello"))
}
}
}

func testUnrecognisedOpcode() async throws {
let app = Application(
router: Router(),
Expand Down

0 comments on commit 9b6d0ab

Please sign in to comment.