funkensturm / ember-local-storage

The addon provides a storageFor computed property that returns a proxy and persists the changes to localStorage or sessionStorage. It ships with an ember-data adapter.
https://www.funkensturm.com/ember-local-storage/
MIT License
218 stars 76 forks source link

TypeError: Unknown StorageFactory when testing in addon #259

Open BryanCrotaz opened 7 years ago

BryanCrotaz commented 7 years ago

Using storageFor in addon fails at test time with error TypeError: Unknown StorageFactory: storage: at createStorage

fsmanuel commented 7 years ago

@BryanCrotaz thanks for reporting. Is the addon public?

BryanCrotaz commented 7 years ago

No, but you should be able to reproduce by creating a service in an addon and having the service use storageFor and get it in init

fsmanuel commented 7 years ago

Did you define the storage object in app/storages or addon/storages?

BryanCrotaz commented 7 years ago

used your generator which puts it in app

fsmanuel commented 7 years ago

Will dig into it.

fsmanuel commented 7 years ago

How do you test it? I mean do you use it in the dummy app or use the addon in a normal app? Would be great if you could provide a repo to reproduce the error.

fsmanuel commented 7 years ago

@BryanCrotaz any news?

tinyweasel commented 7 years ago

Any news on this? I'd like to know how to make the tests work.

fsmanuel commented 7 years ago

@tinyweasel can you provide a repo to reproduce?

fsmanuel commented 6 years ago

@BryanCrotaz @tinyweasel If one of you can provide a repo to reproduce I'm happy to fix it.

carlos-figueroa-globant commented 6 years ago

Hi, any updates with this issue?

fsmanuel commented 6 years ago

@carlos-figueroa-globant I still can not reproduce it. If you have a repo I can test with I'll take a look.

ghost commented 5 years ago

For anyone who may be struggling with this: We discovered that adding the storage key to the needs array in your test seems to solve the problem.

In the route/controller:

myModel: storageFor('my-model')

In the test:

needs: [
    'storage:my-model'
]
fsmanuel commented 5 years ago

@ammorrise Thank you for that hint!