Created
May 6, 2021 15:21
-
-
Save giovani-pereira-ifood/8f71362c034f425b4a41d9f814cee834 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyViewTests: XCTestCase { | |
private let delegateSpy = DelegateSpy() | |
private lazy var sut = { | |
let sut = MyView() | |
sut.delegate = delegateSpy | |
return sut | |
}() | |
func test_pressingActionButton_shouldCallDelegate() { | |
perform(.touchUpInside, from: sut.actionButton, target: sut, args: nil) | |
XCTAssertTrue(delegateSpy.actionCalled) | |
} | |
func test_tappingView_shouldCallDelegate() { | |
performGestureRecognizer(ofType: UITapGestureRecognizer.self, on: sut) | |
XCTAssertTrue(delegateSpy.viewTappedCalled) | |
} | |
func test_longPressingView_shouldCallDelegate() { | |
performGestureRecognizer(ofType: UILongPressGestureRecognizer.self, on: sut) | |
XCTAssertTrue(delegateSpy.longPressedCalled) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment