mardi 16 août 2016

Unit test for helpers Ember-cli

When I create a new helper on Ember-cli, a test is created inside tests/unit/helpers. I would like to know how to test this helpers using the unit test?. I tried to find a documentation, but nothing helps.I need to test the function createArray in order to pass the test coverage to a 100%. Now, this is my helper:

 import Ember from 'ember';

export function createArray(array) {
    return array;
}

export default Ember.Helper.helper(createArray);

This is my unit test: tests/unit/helpers/create-array-test.js

module('Unit | Helper | create array');

// Replace this with your real tests.
test('it works', function(assert) {
  let result = createArray([42]);
  assert.ok(result);
});

Hope someone can guide me.




Aucun commentaire:

Enregistrer un commentaire