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

TypeError: Unknown StorageFactory when testing in addon #259

Open
Tracked by #335
BryanCrotaz opened this issue Jun 14, 2017 · 14 comments
Open
Tracked by #335

TypeError: Unknown StorageFactory when testing in addon #259

BryanCrotaz opened this issue Jun 14, 2017 · 14 comments

Comments

@BryanCrotaz
Copy link

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

@fsmanuel
Copy link
Member

@BryanCrotaz thanks for reporting. Is the addon public?

@BryanCrotaz
Copy link
Author

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
Copy link
Member

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

@BryanCrotaz
Copy link
Author

used your generator which puts it in app

@fsmanuel
Copy link
Member

Will dig into it.

@fsmanuel
Copy link
Member

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
Copy link
Member

@BryanCrotaz any news?

@tinyweasel
Copy link

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

@fsmanuel
Copy link
Member

fsmanuel commented Sep 7, 2017

@tinyweasel can you provide a repo to reproduce?

@fsmanuel
Copy link
Member

fsmanuel commented Dec 8, 2017

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

@carlos-figueroa-globant

Hi, any updates with this issue?

@fsmanuel
Copy link
Member

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

@ammorrise
Copy link

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
Copy link
Member

@ammorrise Thank you for that hint!

@fsmanuel fsmanuel pinned this issue Sep 4, 2019
@fsmanuel fsmanuel unpinned this issue Sep 4, 2019
@fsmanuel fsmanuel mentioned this issue Oct 31, 2021
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants