基於this教程測試使用chai的angularjs應用程序,我想使用「should」樣式添加一個未定義值的測試。這種失敗:Chai:如何使用'should'語法測試未定義的
it ('cannot play outside the board', function() {
scope.play(10).should.be.undefined;
});
錯誤「類型錯誤:無法讀取屬性‘應該’的不確定」,但測試通過用「期待」的風格:
it ('cannot play outside the board', function() {
chai.expect(scope.play(10)).to.be.undefined;
});
我怎樣才能得到它一起工作「應該」?
這是很容易,如果你會用「斷言」,你可以做到這一點的'assert.isUndefined(範圍.play(10))' – lukaserat