mardi 28 avril 2015

Unit testing Ember utils. TypeError: factory.create is not a function

I've created util here: app/utils/filters-serialization.js

export default function filtersToString(search) {
  return 'keyword$MO';
};

And test here: tests/unit/utils/filters-serialization-test.js

import {
  moduleFor,
  test
  } from 'ember-qunit';

moduleFor('util:filters-serialization', {
});

test('it exists', function(assert) {
  var service = this.subject();
  assert.ok(1);
});

I run tests and I've got an error TypeError: factory.create is not a function The problem occurs when I call this.subject();. If I remove this line everything works well. But I It will be great if someone could share his experience in writing unit tests for ember utils. I found another question: Unit testing modules in app/utils for an ember-cli app however this.subject isn't undefined anymore so I think it's good to ask this question again




Aucun commentaire:

Enregistrer un commentaire