[英]Jasmine 2 Spec has no expectations
我有以下測試:
describe('when invoked', function() {
it('should check something', function() {
_.each(someData, function(obj, index) {
expect(obj[index].lable).toBe('foo');
});
});
});
當我運行Jasmine 2.2.0時,出現以下錯誤:
Spec 'SpecLabel function when invoked return value should check something' has no expectations.
我想念什么嗎? 在Jasmin 1.x中,我們可以做到這一點。 在每個for甚至一個for循環中都有期望。
如何修復這些類型的測試? 這些情況的文檔是什么? Jasmine網站並沒有真正的幫助。
快速的解決方法是將測試重構為:
describe('when invoked', function () {
it('should check something', function () {
var success = true;
_.each(someData, function (obj, index) {
success &= obj[index].lable === 'foo';
});
expect(success).toBeTruthy();
});
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.