You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You'd think it would fail if the object had any of those keys. But it actually passes even if it has one or more of them... as long as it doesn't have all of them.
I get why this is: because expect(obj).to.have.keys(keys) asserts that all of the given keys are there, so negating that means negating "all" means "none or some".
But this bit me pretty hard just now, and I wonder if you guys would be open to special-casing this negative assertion to be the more defensive one — and arguably more intuitive and useful as well.
The text was updated successfully, but these errors were encountered:
@aseemk - thanks for the issue. Sorry for the late response on this one. You seem to have a good idea for a fix - would you like to make an attempt at a PR? If you get it merged you'll get a special spot in our super awesome hall of fame!
If I write:
You'd think it would fail if the object had any of those keys. But it actually passes even if it has one or more of them... as long as it doesn't have all of them.
I get why this is: because
expect(obj).to.have.keys(keys)
asserts that all of the given keys are there, so negating that means negating "all" means "none or some".But this bit me pretty hard just now, and I wonder if you guys would be open to special-casing this negative assertion to be the more defensive one — and arguably more intuitive and useful as well.
The text was updated successfully, but these errors were encountered: