我有以下简单的流星方法,我想测试。它将给定的对象插入到我的集合中。
Meteor.methods({
insertHelper(profile){
HelperCollection.insert(profile);
return true;
},
}对于测试,我使用了“分派:摩卡-幻影”,到目前为止,我的测试如下:
describe('methods', () => {
it('can delete owned task', () => {
Meteor.call('insertHelper',{a: 1});
});
});在运行我的测试时,我收到消息“Error: Method 'insertHelper‘not 404”
那么如何从我的测试套件中访问我的Meteor方法呢?
发布于 2016-08-10 09:13:57
正如注释中所讨论的,为了测试Meteor方法,我们必须包括定义Meteor方法的文件:
import '/path/to/method/file.js';
或者使用require:
require('/path/to/methos/file.js');
编辑
如果可以的话,流星建议将使用import而不是require。
https://stackoverflow.com/questions/38868080
复制相似问题