javascriptmocha.jsshould.js

Using should.js how to check whether a string is not present in an array?


Like to check whether a string is present in an array we do someArray.should.contain('str'), but I can't find the negation case check for this.


Solution

  • Using .not should work: someArray.should.not.contain('str')

    The should.js README does not mention .contain(). So if simply inserting .not does not work, use .containEql().