DS.attr()
および/またはDS.belongsTo()
を含むEmber.Mixin
はごくわずかです。私はどのように私はそれらをテストする必要がありますかと思っていた?デフォルトではモデルミックスインとember-cliのユニットテストの方法
、燃えさし-CLI
test('it works', function(assert) {
var MyModelObject = Ember.Object.extend(MyModelMixin);
var subject = MyModelObject.create();
assert.ok(subject);
});
このテストを生成しかし、私はDS.attr()
と対話しようとしたとき、私は、次のエラーを得た:
TypeError: Cannot read property '_attributes' of undefined
at hasValue (http://localhost:4200/assets/vendor.js:90650:25)
at Class.get (http://localhost:4200/assets/vendor.js:90730:13)
at Descriptor.ComputedPropertyPrototype.get (http://localhost:4200/assets/vendor.js:29706:28)
at Object.get (http://localhost:4200/assets/vendor.js:35358:19)
at Class.get (http://localhost:4200/assets/vendor.js:49734:38)
at Object.<anonymous> (http://localhost:4200/assets/tests.js:20126:25)
at runTest (http://localhost:4200/assets/test-support.js:2779:28)
at Object.run (http://localhost:4200/assets/test-support.js:2764:4)
at http://localhost:4200/assets/test-support.js:2906:11
at process (http://localhost:4200/assets/test-support.js:2565:24)
。それを行う最善の方法は何ですか?テスト中にDS.Model
を作成し、それにmixinを適用する必要がありますか?
ありがとうございます!