brain-marks
brain-marks copied to clipboard
126 Add unit tests
Progress on issue #126
What it Does
- Sets up CategoryList and its ViewModel to be testable
- Refactor DataStoreManager into a protocol so it can be mocked
- Added MockDataStoreManager so it can be replaced when testing view models that have it as a dependency
- Adds unit tests for CategoryListViewModel
- Turns on code coverage
How I Tested
Did a quick regression test of the app and everything still works as expected
Notes
I took some initiative on how to refactor the app so that it was more testable based on https://www.swiftbysundell.com/articles/writing-testable-code-when-using-swiftui/ Similarly I chose to use the given, when, then structure for unit tests. If you would like to see tests structured in a different way let me know.
Screenshot