angular-meteor-server icon indicating copy to clipboard operation
angular-meteor-server copied to clipboard

Patch to make services created with angular-server testable

Open Ben305 opened this issue 9 years ago • 2 comments

Make angular-server testable. When angular is setup again and again by unit or integration tests Meteor.methods() is called again and again with the same method object map. The current Meteor version throws an exception if a method is registered to Meteor.methods() more than once with the same method name. So this patch calls Meteor.methods() only with the method names the have not been registered before.

Ben305 avatar Mar 21 '16 08:03 Ben305

Hey @Ben305, Thanks for the PR! Can you provide a reproduction of tests failing because of that case? I'de like to have a look. I feel like using undocumented properties of Meteor is not the best way to go. Maybe other packages have a better solution for this, cause this seems like an issue that would be relevant to any package that registers methods...

netanelgilad avatar Mar 21 '16 08:03 netanelgilad

Hi @netanelgilad,

I have created a sample project that you can use to reproduce the error: https://github.com/Ben305/AngularServerSample

You can start the tests using the the runTests.sh script

Ben305 avatar Mar 30 '16 08:03 Ben305