From 9d2f6dc989813012a47dc2da8a05b7049c1c59cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Oliva?= Date: Tue, 25 Jun 2019 13:03:01 +0200 Subject: [PATCH] docs(oneOf): Add contains flag to oneOf documentation --- lib/chai/core/assertions.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/chai/core/assertions.js b/lib/chai/core/assertions.js index d9daff0d5..f2a74af16 100644 --- a/lib/chai/core/assertions.js +++ b/lib/chai/core/assertions.js @@ -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`.