-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expect.not.objectContaining() does not match documentation #10186
Comments
The |
Not really, honestly. It can be used to assert that a property of an object does not have a given value, e.g. On the other hand, I can't even begin to imagine a use case for asserting that at least one of a number of given properties does not match (to rephrase the documented behavior). Such a test would seem very likely to hide bugs, since any single missing or inequal property would cause a pass. My guess as to the intended behavior was mostly based on the fact that someone went to the trouble of writing a more complex behavior than just negating |
Hmm, I think given that |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
The documentation for expect.not.objectContaining() says that it matches any object that is not a superset of the expected object. In fact, it matches any object that contains no entry equal to any entry of the expected object.
The documentation also says that
expect.not.objectContaining()
is the inverse ofexpect.objectContaining()
. This is not true; for some (expected, received) pairs, neither assertion will match.To Reproduce
Steps to reproduce the behavior:
In this example, the recieved object (
{a: 1, c: 3}
) is not a superset of the expected object ({a: 1, b: 2}
), so according to the documentation, it should match; however, it does not.Expected behavior
The behavior should be changed to reflect what the documentation says.
Link to repl or repo (highly encouraged)
repl.it demo.
envinfo
The text was updated successfully, but these errors were encountered: