This addon adds support for Sinon to assist in testing your Ember CLI app.
git clone <repository-url>
this repositorycd ember-sinon
yarn install
While in testing mode (i.e. either when visiting /tests
or when running ember test
), sinon
will be available as an import.
import sinon from 'sinon';
test(".runCallback() should run the callback passed", function(assert) {
var spy = sinon.spy();
this.subject().runCallback(spy);
// Default Sinon messages:
sinon.assert.calledOnce(spy);
sinon.assert.calledWith(spy, 'foo');
// Custom messages:
assert.ok(spy.calledOnce, "the callback should be called once");
assert.ok(spy.calledWith('foo'), "the callback should be passed 'foo' as an argument");
});
Check out ember-sinon-qunit for QUnit integration!
You must have PhantomJS installed to run tests.
yarn test
(Runsember try:each
to test your addon against multiple Ember versions)ember test
ember test --server
ember build
For more information on using ember-cli, visit https://ember-cli.com/.