Skip to content
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

LocalStorageService does not have a strategy in my test environment? #160

Open
patrick99e99 opened this issue Feb 3, 2022 · 3 comments
Open

Comments

@patrick99e99
Copy link

Versions (please complete the following information):

  • NgxWebstorage: 9.0.0
  • Angular: 13.1.2

I have a custom service which uses LocalStorageService from ngx-webstorage, which works fine in the "real world", but when I try to write a test that interacts with my service, my tests blow up with:

Cannot read properties of undefined (reading 'get') at LocalStorageService.retrieve (node_modules/ngx-webstorage/fesm2015/ngx-webstorage.mjs:74:23)

It appears in the test world this object is getting newed up without a strategy... what am I supposed to do to get this to "just work?" I tried adding NgxWebstorageModule.forRoot() to the imports for my Testbed, but that did not seem to make any difference.

@patrick99e99 patrick99e99 changed the title localstorage does not have a strategy in my test environment? LocalStorageService does not have a strategy in my test environment? Feb 3, 2022
@nicolasquijadafairway
Copy link

I'm getting the same error. I try almost everything. without success? Does somebody have a clue about how to solve this?

TypeError: Cannot read properties of undefined (reading 'get')
    at LocalStorageService.retrieve (http://localhost:9876/_karma_webpack_/node_modules/ngx-webstorage/__ivy_ngcc__/fesm2015/ngx-webstorage.js:74:1)

@logicappsource
Copy link

I am getting same error, any update :/ ?

@Faniahy
Copy link

Faniahy commented Jun 5, 2024

I have a same problem in 2024, ngx-webstorage 7.0.1 with angular 11, Any solution ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants