Skip to content

Explore options for a better Dependency Injection setup #147

@marcosgriselli

Description

@marcosgriselli

There's no way to mock different app states. ProcessInfo.processInfo.arguments.contains("mockRequests") is checking only for real implementation or successful mock which just lets us test the "correct path". It would be really helpful to have a way to inject or set up an object with the desired functionality to generate the expected state.

This approach seems to fit nicely with the current setup and architecture: How to control the world

it would provide us with the ability to write tests in this manner:

func testInterestAreNotShownIfTheresNoiCloud() {
    Current.interestService = { NoiCloudInterestService() } 
    object.fetchInterests() // view model or controller 
    XCTAssertTrue(object.showsiCloudNotConnectedMessage) 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions