Chai:断言数组包括所有项目

时间:2015-07-01 00:28:22

标签: chai

是否可以使用chai断言数组包含多个特定项?

例如,我希望这可行:

['foo', 'bar'].should.include(['foo', 'bar']) 
相反,chai抛出:“预期['foo','bar']包括['foo','bar']”

我也试过这个,但它只断言第一个项目存在:

['foo', 'bar'].should.include('foo', 'bar') // variable args instead of array 

我错过了什么?

1 个答案:

答案 0 :(得分:11)

您可以使用members来预期数组成员。

例如:

UIWindow
相关问题