【发布时间】:2016-08-10 08:31:31
【问题描述】:
我有以下要测试的简单 Meteor 方法。 它将给定的对象插入到我的集合中
Meteor.methods({
insertHelper(profile){
HelperCollection.insert(profile);
return true;
},
}
对于测试,我使用“dispatch:mocha-phantomjs” 到目前为止,我的测试如下:
describe('methods', () => {
it('can delete owned task', () => {
Meteor.call('insertHelper',{a: 1});
});
});
运行测试时,我收到消息“错误:找不到方法 'insertHelper' [404]”
那么我怎样才能从我的测试套件中访问我的 Meteor 方法呢?
【问题讨论】:
-
您是否在测试文件中包含方法文件?
-
谢谢!我忘了在 require('../lib/lib/methods.js'); 中包含我的 methods.js 文件;