For test cookie, we have the random id each time when testing whether the cookie is enabled in the browser, this might introduce too many cookies if the remove operation gets any issue. Following the TS SDK, think we can just use the general key for testing purpose.
With disabledCookies set to true, we still have a topDomain function which still uses the cookies (base-cookie):
move the getLocation and getHost to utils, so we can mock/stub the functions, otherwise as window.location is not writable/configurable, we cannot unit test the features, also moving these two standalone functions into utils for better readability.
skip calling topDomain in MetadataStorage when cookies is disabled.
this case is not testable in localhost as the domain doesn't have multiple levels.
Checklist
[x] Does your PR title have the correct title format?
Summary
For test cookie, we have the random id each time when testing whether the cookie is enabled in the browser, this might introduce too many cookies if the remove operation gets any issue. Following the TS SDK, think we can just use the general key for testing purpose.
With
disabledCookies
set totrue
, we still have atopDomain
function which still uses the cookies (base-cookie
):getLocation
andgetHost
to utils, so we can mock/stub the functions, otherwise aswindow.location
is not writable/configurable, we cannot unit test the features, also moving these two standalone functions into utils for better readability.topDomain
inMetadataStorage
when cookies is disabled.Checklist