【发布时间】:2017-10-21 12:59:34
【问题描述】:
我正在尝试运行 Promise 的测试,但测试失败,认为它超出了超时限制,并建议确保我有 done 子句。
这是我的测试代码的一部分:
$configurations
.updateConfiguration(configurations_driver.NOT_VALID_MODEL) //invalid model
.then(function () {
done(new Error("Expected INVALID_MODEL error but got OK"));
}, function (error) {
chai.assert.isNotNull(error);
chai.expect(error.message).to.be.eq("INVALID_MODEL_ERROR");
chai.expect(error.kind).to.be.eq("ERROR_KIND");
chai.expect(error.path).to.be.eq("ERROR_PATH");
done();
})
.catch(done);
});
如你所见,我有所有的 done 子句,所以我不知道是我在测试中遗漏了什么还是结构错误。
【问题讨论】:
标签: javascript node.js mocha.js chai