brain-marks
brain-marks copied to clipboard
FEATURE: Add unit tests
Is your feature request related to a problem? Please describe. At the moment there are no unit tests and parts of the app (Views and their @State variables) are hard to test.
Describe the solution you'd like Following https://www.swiftbysundell.com/articles/writing-testable-code-when-using-swiftui/ I'd like to do the following:
- Refactor
DataStoreManagerinto a protocol and have the current implementation conform to that protocol. This will set things up nicely to add a mock DataStoreManager so that it can the mock can be used when testing ViewModels that have DataStoreManager as a dependency - Start with
CategoryListand move all of the@Statevariables into the CategoryListViewModel - Write tests for all public functions in CategoryListViewModel
- Turn on code coverage to verify as much of the view model is tested as possible
Describe alternatives you've considered Writing unit tests for the Views directly would be a difficult approach
Additional context Add any other context or screenshots about the feature request here.
@aerickson14 This looks great! If you want to work on this, let me know and I'll assign it to you!
I don't think we need to test the Views, just the ViewModels