meteor-jasmine

Meteor / Jasmine / Velocity : how to test a server method requiring logged in user?

妖精的绣舞 提交于 2020-01-31 08:44:46
问题 Using velocity/jasmine, I'm a bit stuck on how I should test a server-side method requiring that there be a currently logged-in user. Is there a way to make Meteor think a user is logged in via stub/fake ? myServerSideModel.doThisServerSideThing = function(){ var user = Meteor.user(); if(!user) throw new Meteor.Error('403', 'not-autorized'); } Jasmine.onTest(function () { describe("doThisServerSideThing", function(){ it('should only work if user is logged in', function(){ // this only works

Requiring timeouts when testing Meteor with Velocity and Jasmine

陌路散爱 提交于 2019-12-06 05:22:20
问题 Pretty new to meteor, velocity and jasmine so not sure if I am doing something wrong, using Jasmine for something it's not designed for, or this is just the way it works. I am finding I need to set timeouts for pretty much all of my tests in order to get them to pass. Should this be the case or am I doing something incorrectly? For example some tests I am running to check validation messages: describe("add quote validation", function() { beforeEach(function (done) { Router.go('addQuote');

Requiring timeouts when testing Meteor with Velocity and Jasmine

南笙酒味 提交于 2019-12-04 11:05:32
Pretty new to meteor, velocity and jasmine so not sure if I am doing something wrong, using Jasmine for something it's not designed for, or this is just the way it works. I am finding I need to set timeouts for pretty much all of my tests in order to get them to pass. Should this be the case or am I doing something incorrectly? For example some tests I am running to check validation messages: describe("add quote validation", function() { beforeEach(function (done) { Router.go('addQuote'); Tracker.afterFlush(function(){ done(); }); }); beforeEach(waitForRouter); it("should show validation when

Meteor / Jasmine / Velocity : how to test a server method requiring logged in user?

我们两清 提交于 2019-12-03 12:54:32
Using velocity/jasmine, I'm a bit stuck on how I should test a server-side method requiring that there be a currently logged-in user. Is there a way to make Meteor think a user is logged in via stub/fake ? myServerSideModel.doThisServerSideThing = function(){ var user = Meteor.user(); if(!user) throw new Meteor.Error('403', 'not-autorized'); } Jasmine.onTest(function () { describe("doThisServerSideThing", function(){ it('should only work if user is logged in', function(){ // this only works on the client :( Meteor.loginWithPassword('user','pwd', function(err){ expect(err).toBeUndefined(); });