Testing with a fake user


I’m trying to perform unit tests.

I have a collection (equipments) with a list of tags (workshops) and each user has also a list of authorized tags.

I’m trying to retrieve a list of equipments depending on user’s tags. I’m adding a user (Meteor.users.insert () …) but I do not think it is a good way to reach my goal.

I’m using Mocha and PublicationCollector.

Any suggestion ?

Many thanks :blush: !

Not sure if it will help you but I use sinon with Mocha and when I want to return some type of user I use something like this code

sinon.stub(Meteor.users, 'findOne').returns(TestData.mockUser());