lundi 1 février 2016

best practice for unit testing Ember.js util with dependent util

I have an Ember util that I want to unit test. It uses another util.

// utils/util-1.js
import util-2 from './util-2';

export default util1() {
  util2();
}

I want to somehow mock the referenced util. Since it's not an Ember.Object, I can't take advantage of the service injecting system. I'm familiar with node require mocking, but I don't think I can use that here. The best I can come up with is:

// utils/util-1.js
export default util1(util2) {
  util2();
}

Anyone have anything better to share?

Aucun commentaire:

Enregistrer un commentaire