Scenario: I want to integration test component A using a real service my-service
. I have an initializer that is globally injecting the service into all components: application.inject('component', 'myService', 'service:my-service');
. Component A uses Component B in its template, and they both use myService
in their templates.
How do I recreate the global injection? There is no full application, so I can't import and run the real initializer because I don't have the parameter required. this.inject.service
doesn't work because it injects it into test context, not global application context.
I could change all my components' templates to chain the service all the way down: , and then
this.render(hbs``);
But that is a last resort. I could also get rid of the global injection and manually inject in every component. That is also a last resort.
I've tracked down talk of this issue to http://ift.tt/2icKFtf. It was almost implemented, but then closed in favor of Grand Testing Unification http://ift.tt/1nJcJXz. Are there any now solutions while we wait for Grand Testing Unification?
Aucun commentaire:
Enregistrer un commentaire