You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`
func testValidHost() {
let validHostName = "invalidhost"
guard let reachability = try? Reachability(hostname: validHostName) else {
return XCTFail("Unable to create reachability")
}
let expected = expectation(description: "Check valid host")
reachability.whenReachable = { reachability in
print("Pass: \(validHostName) is reachable - \(reachability)")
expected.fulfill()
// Only fulfill the expectation on host reachable
}
reachability.whenUnreachable = { reachability in
print("\(validHostName) is initially unreachable - \(reachability)")
// Expectation isn't fulfilled here, so wait will time out if this is the only closure called
}
do {
try reachability.startNotifier()
} catch {
return XCTFail("Unable to start notifier")
}
waitForExpectations(timeout: 5, handler: nil)
reachability.stopNotifier()
}
Pass: invalidhost is reachable - Reachability.Reachability
The text was updated successfully, but these errors were encountered: