Skip to content

Instantly share code, notes, and snippets.

@giovani-pereira-ifood
Last active January 11, 2020 15:47
Show Gist options
  • Save giovani-pereira-ifood/682c38c547b435183300aa58c8757cc0 to your computer and use it in GitHub Desktop.
Save giovani-pereira-ifood/682c38c547b435183300aa58c8757cc0 to your computer and use it in GitHub Desktop.
mirror extension usage
class SceneCreatorTest: XCTestCase {
private let sut = SceneCreator()
func test_presentersViewShouldBeTheSameAsCreatedScene() {
// Given
let scene = sut.createScene()
// When
let interactor = mirror(property: .interactor, ofType: Interactor.self, from: scene)
let presenter = mirror(property: .presenter, ofType: Presenter.self, from: interactor)
let presentersView = mirror(property: .viewController, ofType: ViewController.self, from: presenter)
//Then
XCTAssertNotNil(presentersView) // Check if there is a view on the presenter
XCTAssertTrue(presentersView === scene) // and if its the same as `scene`
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment