"chainable" 在测试(mocha,chai)的上下文中是什么意思?

What does "chainable" in context of testing (mocha, chai) mean?

我是 JavaScript 和测试的新手。直到最近,我才写了人生中的第一次测试。我指的是 "Chai.js" 文档,上面写着:

The assert style is very similar to node.js' included assert module, with a bit of extra sugar. Of the three style options, assert is the only one that is not chainable. Check out the Style Guide for a comparison.

The BDD styles are expect and should. Both use the same chainable language to construct assertions, but they differ in the way an assertion is initially constructed. Check out the Style Guide for a comparison.

"chainable language to construct assertions" 是什么意思? 这是我写的测试文件的example

谢谢!

chai 中的 expect/should 断言可以在看起来像单个语句的情况下相互链接。在以下示例中,首先对对象执行断言,然后对对象的 属性 执行断言,该对象成为第一个断言之后的链接上下文:

expect({ foo: 'baz' }).to.have.property('foo')
  .and.not.equal('bar');

如果你想对断言做同样的事情,你必须在两个不同的断言中完成它,一个将在对象上执行,另一个在对象的 属性 上执行:

var foo = { foo: 'baz' };
assert.property(foo, "foo", "object does not contain a foo property");
assert.notEqual(foo.foo, "bar", "The foo property is equal to 'bar'");