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을 적용해야합니까?
감사합니다.