chris-mosley / AmazonBrandFilter

Filters Amazon search results to only be "known" brands.
MIT License
44 stars 5 forks source link

Fix settings not available bug and adding test suite #42

Closed barrymun closed 10 months ago

barrymun commented 11 months ago

Description

Changes

barrymun commented 10 months ago

@chris-mosley there are some nice changes in this pr; i've tried to document all of the alterations but please have a look through the description.

the background script has been given a big rework so that we only set the storage values once to avoid race conditions where some (or all) of the values may not actually exist in storage. i've also improved the typing around the getStorageValue and setStorageValue functions so it should tell us if we're trying to set values in storage that should not be set (for example, we should not set brandsMap in sync storage as this will result in errors for chrome extensions).

i've also included the basic work for a test suite which can be expanded on to make the code more resilient in the future too.

i would appreciate it if you could test this one before merge when you get a chance, as there are a lot of changes. if there are any issues, or you spot any problems when using the extension/addon, please let me know and i can try to fix before we merge. if you have any other questions please don't hesitate to ask. i've tested as best i can and everything seems to work correctly on my end, but it's always good to get another pair of eyes on larger prs. thanks

chris-mosley commented 10 months ago

Did a fair amount of testing on this and it seems to be working. I did uninstall and reload it a few times but i believe when i do that I get a new guid for the addon, so I'm not certain that it really tested overwriting of old settings or not.