我正在ember-cli应用程序中使用ember-cli。我的应用程序仍然没有使用ember-data作为模型。
moduleForModel助手根本不起作用。是否需要从DS.Model扩展模型以使用ember-qunit?
发布于 2015-07-22 03:24:49
老实说,关于测试简单模型(混合中没有simple数据)的最好部分是,您可以像普通的旧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');
});https://stackoverflow.com/questions/31552959
复制相似问题