柴应该是不确定的
我已经安装了摩卡和柴。
在我的unit testing中:
import {expect, should} from "chai"; describe("array", function () { it("has length of 1", function (done) { var arr = ["B"]; expect(arr).have.lengthOf(1); arr.should.have.lengthOf(1); }); });
expect
按预期工作,但should
是不确定的。
为什么?
你应该在文件的开头调用chai.should()
来使用样式。
它将扩展每个对象与一个should
属性来开始你的断言链。
您可以在chai文档中find更多使用示例。