Skip to content

Commit

Permalink
docs(oneOf): Add contains flag to oneOf documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
voliva committed Jun 26, 2019
1 parent 7eaf684 commit 9d2f6dc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/chai/core/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3117,6 +3117,14 @@ module.exports = function (chai, _) {
* expect(1).to.equal(1); // Recommended
* expect(1).to.not.be.oneOf([2, 3, 4]); // Not recommended
*
* It can also be chained with `.contain` or `.include`, which will work with
* both arrays and strings:
*
* expect('Today is sunny').to.contain.oneOf(['sunny', 'cloudy'])
* expect('Today is rainy').to.not.contain.oneOf(['sunny', 'cloudy'])
* expect([1,2,3]).to.contain.oneOf([3,4,5])
* expect([1,2,3]).to.not.contain.oneOf([4,5,6])
*
* `.oneOf` accepts an optional `msg` argument which is a custom error message
* to show when the assertion fails. The message can also be given as the
* second argument to `expect`.
Expand Down

0 comments on commit 9d2f6dc

Please sign in to comment.