Javascript 使用expect并比较数组中的每个值进行业力测试

Javascript 使用expect并比较数组中的每个值进行业力测试,javascript,arrays,karma-runner,Javascript,Arrays,Karma Runner,如何编写expect(),使其循环遍历数组中的每个值,如果它与数组中的任何值匹配,则使其失败 it('that it should never equal to any value from the array', function () { var productName = $('#someId').text(); expect(productName).not.to.equal(['Quit','Exit','Stop']); }); 我通过在expect()中的数组上使用循环来

如何编写expect(),使其循环遍历数组中的每个值,如果它与数组中的任何值匹配,则使其失败

it('that it should never equal to any value from the array', function () {
  var productName = $('#someId').text();
  expect(productName).not.to.equal(['Quit','Exit','Stop']);
});

我通过在expect()中的数组上使用循环来实现它。它工作得很好