Unable to call Meteor methods from mocha js


Im working on a project built in Meteor + angular1 .
We are using Mocha for writing unit test-cases
.Iam unable to call a serverside method from my testjs file.I have my test file in imports folder.

my server-side method:
testcall:function() {
console.log(‘hello there’);
return “luck”;

my test-case:

describe(‘testcall’, function () {
it(‘shuold call testcall method’, function () {
Meteor.methods.call(‘testcall’, function(error, result) {
console.log(error || result);

"Method testcall not found’’.

Any ideas?



You need to register the method in the test so it actually exists


Thankyou for the reply henribeck
Can you please breif It.



Assume you have a methods.js file and a methods.test.js file


import './methods';

// Now you can call any method that you defined in methods.js via Meteor.call()