Skip to content

Commit

Permalink
Updating tests
Browse files Browse the repository at this point in the history
  • Loading branch information
swhitty committed Oct 24, 2023
1 parent fc1f186 commit ab4cb46
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions FlyingFox/Tests/HTTPServerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ final class HTTPServerTests: XCTestCase {
}
}

func testThrowsError_WhenSocketAlreadyListening() async throws {
let server = HTTPServer.make(port: 42185)
let socket = try await server.makeSocketAndListen()
defer { try! socket.close() }

await AsyncAssertThrowsError(try await server.start(), of: SocketError.self) {
XCTAssertTrue(
$0.errorDescription?.contains("Address already in use") == true
)
}
}

func testRestarts_AfterStopped() async throws {
let server = HTTPServer.make()
try await startServer(server)
Expand Down

0 comments on commit ab4cb46

Please sign in to comment.