Meteor.wrapAsync returning undefined inside Velocity Test

76 views Asked by At

I am trying to unit test a method in my Meteor app. My simple method looks like this:

function hello(arg, cb) {
  console.log('-=> arg: ' + arg);
  seTimeout(function() {
    cb(null, 'hello! ' + arg);
   }, 3000);
}

And my test is

it('should say hello', function () {
  var syncHello = Meteor.wrapAsync(hello);
  console.log(JSON.stringify('-=> async hello: ' + hello));
  console.log(JSON.stringify('-=> sync hello: ' + syncHello));
  var resp = syncHello('joe');
  expect(resp).toEqual('hello! joe')
})

But when I run my test, it is failing because syncHello is undefined. It will be very helpful if I know the reason why Meteor.wrapAsync is returning undefined when I am unit-testing and help me to run this function synchronously.

0

There are 0 answers