I am just getting started using Ember. Coming from an Angular background, I really want to use BDD (Mocha) and Karma for test-running. Anyhow, I was very confused about how to create some simple model instances for some simple unit tests, and came up with the following. I am wondering if this is considered best practice until the ember-mocha-adapter project gets a little better with regard to helpers? Thanks for any insight.
/* global describe, it, beforeEach, afterEach */
(function(app) {
'use strict';
describe('MyModel Model', function() {
var store;
beforeEach(function() {
app.reset();
store = app.__container__.lookup('store:main');
});
describe('#init', function() {
it('should create an id', function() {
Ember.run(function() {
var model = store.createRecord(app.MyModel, {
someProp: 'something'
});
model.get('id').should.exist;
});
});
});
});
})(window.MyEmberApp);