我正在使用 Chai.js 编写一些自动化测试。我有一根绳子:
url(http://somewhere.com/images/myimage.png)
我想做这样的事情:
expect(thatSelectedItem).contains.any('jpg', 'png', 'gif')
但是在 chai.js 中似乎找不到任何东西
任何有任何建议 - 请阅读页面http://chaijs.com/api/bdd/但是没有运气。
使用普通 Chai(无需额外插件),您可以使用
match
expect(thatSelectedItem).to.match(/(?:jpg|png|gif)/)
expect(thatSelectedItem).to.contain.oneOf(['jpg', 'png', 'gif'])
此版本与 v4.3.0(docs)一起发布。
oneOf
contain
contains
include
includes