Add extensive unit-tests for Interactor and Router #18
+514
−90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
This PR adds extensive unit-tests for
Interactor,PresentableInteractor,Router, andViewableRouter. Test coverage has increased from 54.8% to 75.3%.Before

After

The remaining uncovered methods or classes are either initializers with no logic in them or the
LeakDetecoror the Componentized builders. Both require additional inquiry on test coverage or refactoring to be testable.Changes:
This PR contains only unit-test coverage with no structural changes to the implementation code with the exception of the
LeakDetector.Since the LeakDetector is currently a static singleton instance it is not facilitating or allowing testability. I had to, technically, make public API change to it:
Change the singleton static property declaration from
public static let instance = LeakDetector()topublic static private(set) var instance = LeakDetector()to allow for injecting a new instance in unit-tests via new internal methodstatic func setInstance(_ newInstance: LeakDetector).Since
public static let instance = LeakDetector()was previously declared aspublicI preserved it's public getter API with this change and set the setter as internal and accessible only within the library's codebase by usingprivate(set). Outside users of the library won't be able to set new instances which means that the public API remains in tact and this is not a breaking change.However, I question whether the instance needs to be publicly exposed to the library users in the first place: #17
Related issue(s):
This resolves #5