Skip to content

Instantly share code, notes, and snippets.

@jinahadam
Last active March 1, 2018 10:31
Show Gist options
  • Save jinahadam/c7bff47798c7e81ad3a45afca6f07664 to your computer and use it in GitHub Desktop.
Save jinahadam/c7bff47798c7e81ad3a45afca6f07664 to your computer and use it in GitHub Desktop.
#swift #testing
func testInfoLoading() {
let url = "https://raw.githubusercontent.com/FahimF/Test/master/DogYears-Info.rtf"
HTTPClient.shared.get(url: url) {
(data, error) in
self.resData = data
}
let pred = NSPredicate(format: "resData != nil")
let exp = expectation(for: pred, evaluatedWith: self, handler: nil)
let res = XCTWaiter.wait(for: [exp], timeout: 5.0)
if res == XCTWaiter.Result.completed {
XCTAssertNotNil(resData, "No data recived from the server for InfoView content")
} else {
XCTAssert(false, "The call to get the URL ran into some other error")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment