Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. class LoginTests: XCTestCase {
  2.  
  3. let viewControllerToTest = ViewController()
  4.  
  5. func testLogin() {
  6.  
  7. // 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
  8. let loginExpectation = expectation(description: "should call login")
  9. viewController.login("testEmail", "testPassword", completion: { success in
  10. loginExpectation.fulfill()
  11. XCTAssertTrue(success)
  12. })
  13.  
  14. wait(for: loginExpectation, timeout: 0.1)
  15. }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement