How to unit test a meteor 'method'

I’m using the recommended meteor-mocha. I don’t even understand if ‘methods’ could be unit tested or not. I’m new to meteor, and I’m totally stumped.

Take a look at the Guide’s reference app todos. It includes a few unit tests for its Methods. For example, the list methods have unit tests defined here.

1 Like

I did look at that. He hasn’t used any functions in Meteor.methods() in the application. I’m having trouble accessing a function defined in Meteor.methods() from server-side test file.

1 Like

The test is using Meteor validated methods e.g. here (on top of Meteor.methods)

Validated method has method _execute for test code

1 Like

please, I have a meteor.call(‘one’,()=>{}) in client,when run unit test, how i can call the method from server side?

please can you help me ? I have a meteor.call('one',()=>{}) in client,when run unit test, how i can call the method from server side?

Methods are very testable - see examples using mocha over here: sequent/src/testSuite/methods at master · dmarkrollins/sequent · GitHub