You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Opening in case other's have had the same issue. In 4.0.2 I have a jest test that set's a cookie and a function being tested that read's the cookie. The cookie comes back as undefined.
Downgrading to 4.0.0 fixes the issue for me.
Example:
// testFunc.jsimportCookiesfrom'universal-cookie';constcookies=newCookies();consttestFunc=()=>(cookies.get('testCookie'));// testFunc.spec.jsimportCookiesfrom'universal-cookie'importtestFuncfrom'./testFunc';constcookies=newCookies();test('testFunc',()=>{cookies.set('testCookie','blah');// logging cookies.get('testCookie') correctly logs 'blah'constresult=testFunc();expect(result).toEqual('blah');// fails - result is actually `undefined`});
The text was updated successfully, but these errors were encountered:
the DOCUMENT_HAS_COOKIE is initialized as false in versions greater than 4.0.0.
Setting this value to true in both the .js file and test file seems to fix this issue. But I would just stick with the 4.0.0 version until it can get fixed :D
Hello!
Opening in case other's have had the same issue. In
4.0.2
I have a jest test that set's a cookie and a function being tested that read's the cookie. The cookie comes back asundefined
.Downgrading to
4.0.0
fixes the issue for me.Example:
The text was updated successfully, but these errors were encountered: