如何进口"测试双打

时间:2016-04-12 08:45:45

标签: unit-testing ember.js

我有一个现有的EmberJS代码库,我想在其上介绍一些单元测试,但我需要模拟一些包含的文件。在下面的示例中,如何将HelperClass注入单元测试主题。目前主题无法实例化,因为实际的HelperClass会吸收大量内容。

由于 罗布

应用程序/模型/ MY-model.js

import DS from 'ember-data';
import HelperClass from '../../utils/helper-class';
let model = DS.Model.extend({
    Title: DS.attr('string'),
});
HelperClass.something({ model: model });
export default model;

测试/单元/模型/我的模型-test.js

import { moduleForModel, test } from 'ember-qunit';
moduleForModel('my-model', 'Unit | Model | my model', {
    // Specify the other units that are required for this test.
    needs: [],
});
test('it exists', function(assert) {

    // This throws an error !!!!
    var model = this.subject();
    assert.ok(!!model);
});

0 个答案:

没有答案