我ember-qunit
在ember-cli
应用程序中使用。我的应用程序仍未ember-data
用于模型。
moduleForModel
助手根本不起作用。是否需要将模型扩展DS.Model
为使用ember-qunit
?
我ember-qunit
在ember-cli
应用程序中使用。我的应用程序仍未ember-data
用于模型。
moduleForModel
助手根本不起作用。是否需要将模型扩展DS.Model
为使用ember-qunit
?
老实说,测试简单模型(没有 ember-data 混合)最好的部分是您可以像普通的旧 javascript 对象一样新建它们。
import { test, module } from 'qunit';
import Foo from 'myapp/models/foo';
module('my first unit test');
test('do something with a computed property', function(assert) {
var foo = new Foo();
foo.set('id', 1);
foo.set('first', 'toran');
foo.set('last', 'billups');
//or this var foo = Foo.create({id: 1, first: 'toran', last: 'billups'});
assert.equal(foo.get('full'), 'toran billups');
});