使用 seqalizerjs,解决一个承诺:
return new Promise(function(resolve, reject){
return models.merchants.create({
name: ctx.name,
});
}).then(function(result){
resolve({
id: result.id
});
}).catch(function(err){
reject(err);
});
以 chai 作为承诺进行测试
return user.save(data).should.eventually.equal('123123');
但我总是得到这个:
Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure
it resolves.