This is a way bigger PR than I expected, so please feel free to kick it back to me to break it up into smaller pieces. Once I started breaking things down to make them more testable it was kind of a slippery reorganization slope. I'm pushing it up now before it gets wilder.
Here's what you'll see:
Adds packages: jest for running tests and babel to help jest run correctly
Adds basic tests to models - mostly extremely basic, just saying "hey, does this function?" Since I don't yet know enough about the app or about bookbinding to make any real judgements about what's working right and what's not, any assertions you see in the tests are literally just copied from the actual output of the functions being tested - I was working under the assumption that most things are working as-intended, but that should be vetted.
Refactors preload.js into several modules - the main file should be much easier to read at a glance now. I moved the existing logic into groups based on what sorts of things they're accomplishing (change handling, rendering, etc). I don't believe there are substantive changes to any of this logic, just reorganization for the sake of easier reading and debugging.
Adds tests for the local storage functions.
Moves constants into their own file.
Again, please feel free to send this back to me and I'll break it down! Let me know if there are any changes that need to be made.
This is a way bigger PR than I expected, so please feel free to kick it back to me to break it up into smaller pieces. Once I started breaking things down to make them more testable it was kind of a slippery reorganization slope. I'm pushing it up now before it gets wilder.
Here's what you'll see:
jest
for running tests andbabel
to help jest run correctlypreload.js
into several modules - the main file should be much easier to read at a glance now. I moved the existing logic into groups based on what sorts of things they're accomplishing (change handling, rendering, etc). I don't believe there are substantive changes to any of this logic, just reorganization for the sake of easier reading and debugging.Again, please feel free to send this back to me and I'll break it down! Let me know if there are any changes that need to be made.