Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore options for a better Dependency Injection setup #147

Open
marcosgriselli opened this issue Jan 25, 2019 · 0 comments
Open

Explore options for a better Dependency Injection setup #147

marcosgriselli opened this issue Jan 25, 2019 · 0 comments

Comments

@marcosgriselli
Copy link
Contributor

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) 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant