expect(x).to.include.oneOf["a","b"] behaves as if it's expect(x).to.be.oneOf["a","b"]
expect(x).to.include.oneOf["a","b"] behaves as if it's expect(x).to.be.oneOf["a","b"]
The assertion " expect("Login IRIS").to.include.oneOf(["","Login"],error);"
results in the following, as if "to.be.oneOf" was used:
AssertionError: Access validation failed -page accessible when not expected: expected 'Login IRIS' to be one of [ '', 'Login' ]
Hi @osmolyar, thanks for your issue 😊
This is expected and I believe this is related to #1241, correct?
If we're accepting contains to work with oneOf I think includes should make sense too.
Please feel free to open a PR for this feature. The core team is currently working on the new version, which is mostly a rewrite and therefore we will not have time to open a PR for this ourselves. This should be just like #1241 though.
Hi, is there any progress? I believe it's not expected since it contradicts with examples in docs.
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'])
Hello would like to see progress on this issue
They below line does not work
expect('Today is sunny').to.contain.oneOf(['sunny', 'cloudy'])
4 years later since the original post, same issue
I think this issue was resolved in #1242, since the work was released in version 4.3.0(https://github.com/chaijs/chai/releases/tag/4.3.0), it is expected that the above issue will be resolved in later versions.
In fact, if we use the latest version, the code below passes the test normally.
expect("Login IRIS").to.include.oneOf(["","Login"])
expect('Today is sunny').to.contain.oneOf(['sunny1', 'cloudy'])