Code review? How can I improve this test?


Let me just start off by saying that I’m new at Ember. I’ve tried many times trying to get into Ember but every time, I end up going back to Angular because it just clicks for me. I’m trying really hard not to give in to it this time around.

I’m having a hard time determining what “idiomatic Ember” is. I assumed that one of the main benefits to Ember and their whole convention over configuration policy is that there’s an “Ember way” of doing things. Is that right?

My latest attempt at Ember is using everything that Ember suggests. ember-cli, qunit, ic-ajax, ember data… Yet, I’m still having a lot of trouble figuring out how to put everything together. Is there any recommended reading I could do that would hopefully make things clearer for me? I’ve gone through the Ember and ember-cli guides.

Sorry for the rant… now to my actual question: Can anyone help me improve this test? I’ve hacked it up to hopefully demonstrate what I want to test, but I’m sure this isn’t the right way to do it.

/sunday route:

export default Ember.Route.extend({
  model: function() {
    var _this = this;
    return request('/api/v1/sunday').then(function(data) {
      var bulletin ='bulletin', data.bulletin);
      return'bulletin', bulletin);


test('it returns the normalized sunday bulletin', function() {

  var container = new Ember.Container();
  container.register('store:main', DS.Store);

  var store = container.lookup('store:main');

  var route = this.subject(); = {
    normalize: function(modelName, model) {
      equal('bulletin', modelName);
      equal('Sunday Service',; = 'Normalized ' +;
      return model;
    push: function(modelName, model) {
      equal('bulletin', modelName);
      equal('Normalized Sunday Service',;
      return model;

  route.model().then(function(bulletin) {
    equal('Normalized Sunday Service',;

I’m trying to verify that my model hook is

  • fetching data from api/v1/sunday
  • returning a normalized Bulletin object from the json returned from api/v1/sunday.

The code can be found here:

Is there a cleaner way to do this? Can I use an actual Ember Data store instead of mocking it?

Thanks for your time.