brain-marks icon indicating copy to clipboard operation
brain-marks copied to clipboard

126 Add unit tests

Open aerickson14 opened this issue 3 years ago • 0 comments

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

Screen Shot 2022-05-14 at 9 10 04 PM

aerickson14 avatar May 15 '22 03:05 aerickson14