Skip to content

Conversation

@alexvbush
Copy link
Collaborator

Description:

This PR adds extensive unit-tests for Interactor, PresentableInteractor, Router, and ViewableRouter. Test coverage has increased from 54.8% to 75.3%.

Before
Screenshot 2025-07-26 at 5 22 58 PM

After
Screenshot 2025-07-26 at 5 23 23 PM

The remaining uncovered methods or classes are either initializers with no logic in them or the LeakDetecor or 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() to public static private(set) var instance = LeakDetector() to allow for injecting a new instance in unit-tests via new internal method static func setInstance(_ newInstance: LeakDetector).

Since public static let instance = LeakDetector() was previously declared as public I preserved it's public getter API with this change and set the setter as internal and accessible only within the library's codebase by using private(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

@rudro rudro merged commit e305157 into uber:main Aug 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more, enhance, and update unit-tests

2 participants