How to unit test Meteor methods

Hi Guys,
Please suggest me
what are the best practices for unit testing Meteor methods ??

Do we really need to mock the database calls and other import calls ??
If yes, what is the best framework or package which does it and any sample example implementation will help me a lot!!

Note: Please give me some sample boiler plate to get started.

Thanks,

Hi!
We’re using Meteor Factory to mock our DB and assure our methods are working correctly.

Here’s a link with a boilerplate of a server-side method test. There’s a lot of setup code to allow this.userId to work inside the method (see beforeEach and afterEach hooks)

Hope that it helps!

1 Like