use-shopping-cart icon indicating copy to clipboard operation
use-shopping-cart copied to clipboard

Test: Server-side environment

Open andria-dev opened this issue 4 years ago • 2 comments

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.

andria-dev avatar May 01 '20 20:05 andria-dev

@ChrisBrownie55 wasn't this kind of addressed? We have logic that checks if isClient, if not, it defaults to some values.

dayhaysoos avatar Jun 09 '20 18:06 dayhaysoos

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

andria-dev avatar Jun 09 '20 20:06 andria-dev