use-shopping-cart
use-shopping-cart copied to clipboard
Test: Server-side environment
We recently ran into an error that dealt with accessing navigator.language
without ensuring we were in a client environment (the browser, or a place with access to a window). In light of this, we should add tests that ensure this doesn't happen again.
What needs to be done
Essentially, we just need to call every method and try to cause every edge case with the Window
object disabled.
Sidenote:
This also makes me think that we might need to turn isClient
into a function so that it can detect a change between server-side and client-side instead of it being a fixed value for testing purposes.
@ChrisBrownie55 wasn't this kind of addressed? We have logic that checks if isClient
, if not, it defaults to some values.
Yeah we addressed it in the libraries code but we don't have any tests to catch errors like that and prevent them from being reintroduced