回调断言不起作用

时间:2017-01-18 16:11:02

标签: javascript

我在以下代码中有一个断言。我正在测试失败。我没有看到断言错误,而是在最后看到以下警告。

var sendData = {msg:"Hello1"};

console.log("Send Data: "+util.inspect(sendData));
sendQueue.add(sendData);

receiveQueue.process(function (job, done) {
    var receivedData = job.data;
    console.log("Received data: ", util.inspect(receivedData));

    //FORCE FAILURE
    assert(1,2));

    done();
});

输出:

Send Data: { msg: 'Hello1' }
Received data:  { msg: 'Hello1' } 
(node:16972) Warning: a promise was created in a handler at /usr/apps/myapp/node_modules/bull/lib/queue.js:688:9 but was not returned from it, see ...
at new Promise (/usr/apps/myapp/node_modules/bluebird/js/release/promise.js:77:14)
(node:16972) Warning: .then() only accepts functions but was passed: [object Object]

0 个答案:

没有答案