Hola
So I’m using sinon, chai as mentioned in the guide [and am testing/spying on many other things successfully]… and I have many helper methods (thanks to excellent dburles:collection-helpers) defined similar to below:
Meteor.users.helpers({
doSomething() {
},
Typically in my methods I’ll look up user and call helper Meteor.users.findOne(id).doSomething()
How do I test such a scenario? Tried the below options and nothing seems to work.
let something = sandbox.spy(Meteor.users._helpers.prototype, "doSomething") //looked at dburles:collection-helpers code to see where the helpers are defined but the expect(something).to.have.been.called fails
//
let something = sandbox.spy(Meteor.users, "doSomething") // fails
//
let user = Meteor.users.findOne(id)
let something = sandbox.spy(user, "doSomething") // fails as user = different instance of course
Any ideas how to resolve this please?
Thanks