mardi 5 avril 2016

Ember helper unit test - inject or mock service

I'm on Ember 1.13 (not 2.x yet), and I need to be able to run a helper unit test. My helper has a line:

const i18n = Frontend.__container__.lookup('service:i18n');

which injects a service the ugly way, since before Ember 2.x helpers are not "real" objects and cannot do something like:

i18n: Ember.inject.service('i18n')

When I try to run simple unit tests for the helper, I get:

Can't find variable: Frontend

How do I import/inject/mock the global app namespace in this case? Or is there another way to get past this?




Aucun commentaire:

Enregistrer un commentaire