-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using in jest tests #113
Comments
running into the same thing with cannot read |
It should be easy to use import Cookies from 'universal-cookie'
const cookieHandler = new Cookies({ myCookie: 'meow!' });
cookieHandler.set('foo', {}, { path: '/' }); If you don't have any cookie, you can set an empty object. |
i have the same issue. cookies = new Cookies({})
cookies.HAS_DOCUMENT_COOKIE = false if not, universal-cookie believes environnement is browser, because jest load jsdom... |
I had the same issue, and Any thoughts on exposing this publicly? Or are there any better ways to make this jest-friendly? |
@pdesantis it won't work in typescript. |
In |
Would there be any other solution in making this work in typescript too? |
I was able to fix this in my case by specifying https://jestjs.io/docs/en/configuration.html#testenvironment-string |
@chj-damon @mocantimoteidavid I got it to work in typescript by doing this: cookies = new Cookies({})
cookies['HAS_DOCUMENT_COOKIE'] = false |
Hi,
I would like to know out to use it in jest environment once I'm getting this error:
I tried to set the cookie in the test like this, before calling the usage in app, but it didn't work:
Thanks
The text was updated successfully, but these errors were encountered: