lundi 20 avril 2015

How do I depend on the store as a service in Ember unit tests using qunit?

According to the blog-post for ember-data version 1.0.0-beta.16 the store can now be used as a service:

TweetComposerComponent = Ember.Component.extend({
  store: Ember.inject.service()      
});

However, I can't figure out how to do qunit unit tests on such a component. I've tried the following:

moduleForComponent('tweet-composer', {
  needs: ['service:store']
});

and:

moduleForComponent('tweet-composer', {
  needs: ['store:main']
});

And when I do the former I get an error Attempting to register an unknown factory: 'service:store' and if I do the latter then store is undefined.

Thoughts?

(I'm writing a ember-cli style app).




Aucun commentaire:

Enregistrer un commentaire