Skip to content

Instantly share code, notes, and snippets.

@catalinaturlea
Created September 25, 2019 19:09
Show Gist options
  • Save catalinaturlea/750682854151b7b250f28a7057351689 to your computer and use it in GitHub Desktop.
Save catalinaturlea/750682854151b7b250f28a7057351689 to your computer and use it in GitHub Desktop.
LoginTests-version1
class LoginTests: XCTestCase {
let viewControllerToTest = ViewController()
func testLogin() {
// Since this is an async call we need to wait for the callback in the test - otherwise we will not run long enought to get the response
let loginExpectation = expectation(description: "should call login")
viewController.login("testEmail", "testPassword", completion: { success in
loginExpectation.fulfill()
XCTAssertTrue(success)
})
wait(for: loginExpectation, timeout: 0.1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment