How to simulate that a user is logged on the server?

Hi,
I can not test this method:

'services.insert'(name,description,price, category, orgId) {
    if (!this.userId ||
        !Roles.userIsInRole(this.userId,
                            ['organizations:write','admin'], 'pathkan-manager')) {
      
      throw new Meteor.Error(403, "Access denied");
    }

    let validateCategory;
    validateCategory = isNull(category);

    Services.insert({
      name,
      price,
      description,
      category,
      orgId,
      // owner: Meteor.userId(),
      createdAt: new Date() // current time
    });
  },

Throw me: 403, Access denied. How can I simulate that a user is logged in?

1 Like