Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Using custom document or cookie object on CookieStorage initialization #12

Open
imcrazytwkr opened this issue Jan 19, 2019 · 0 comments

Comments

@imcrazytwkr
Copy link

First and foremost, thank you for writing this library. I'm currently migrating from a legacy and deprecated cookie-monster to it and wanted to ask if it is possible to add support for passing custom document or cookie object as an argument (or a config parameter) to a constructor.

It proves to be very useful for unit testing as you can pass mock cookie object and verify the component's results without the need to monkey-patch Node's global namespace. Currently I solve it with inheriting CookieStorage class and overriding the ._getCookie() and ._setCookie() methods during testing but it doesn't seem like a clean solution to me. If you are interested in implementing this feature, I can provide a pull request.

@imcrazytwkr imcrazytwkr changed the title Using custom document or cookie object on object initialization Using custom document or cookie object on CookieStorage initialization Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant