ios – XCTest calls 2 completely different implementations(module and after mock) with failing


I need to check controller with presenter, passing mock loader to presenter.
I’ve compose technique which has StoreType argument for presenter. I exploit manufacturing controller with presenter, simply mocking retailer. Even with out compose technique, with direct constructing in makeSUT, I’ve downside, that I run check of viewDidLoad and: 1. created VC with manufacturing retailer in SceneDelegate, viewDidLoad is named, after that check fails, 2. created VC with MockStore and it would not matter already.

func testViewDidLoad() {
            let retailer = MockStore()
    let sut = makeSUT(localStore: retailer)

    XCTAssertTrue(sut.historical past.isEmpty) // simply instance

func makeSUT(localStore: StoreType) -> MyViewController {
   return Composer.compose(localStore: localStore)

closing class Composer {
    static func compose(localStore: StoreType) -> MyViewController {
        let loader = LocalLoader(retailer: localStore)
        let presenter = MyPresenter(localLoader: loader)
        let vc = MyViewController(presenter: presenter)
        presenter.view = vc
        return vc

The identical compose technique is named in SceneDelegate in scene(_ scene: UIScene, willConnectTo session.

I do not perceive why I’ve two calls of viewDidLoad, initialization with manufacturing implementation on check? How can I take away it, what’s incorrect right here?