-
Notifications
You must be signed in to change notification settings - Fork 4
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
Handle empty objects in EqualKeys
#50
Conversation
4920d52
to
77374da
Compare
f183494
to
697cc58
Compare
ping @nunofgs |
@@ -35,7 +35,7 @@ describe('EqualKeysAssert', () => { | |||
}); | |||
}); | |||
|
|||
it('should throw an error if an object does not have the expected keys', () => { | |||
it('should throw an error if the object not have the expected keys', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does not
?
Hey guys, not trying to be difficult but I'm still having trouble with this concept. I personally dislike mixing "empty object" validation with key matching but I will of course capitulate if the intent is to follow the should.js implementation (as mentioned here). Having said that, I believe the following should not throw an error: // This throws an error.
new Assert().EqualKeys().validate({});
// Since this also does not throw an error.
({}).should.have.keys(); If you fix that issue, I have no further objections. /cc @ricardogama, @ruimarinho |
Also, regardless of the decision, should we also update the README with a description of the breaking change? |
} | ||
}); | ||
|
||
it('should allow setting no keys', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are we setting here? WDYT of rewording to something along the lines of:
'should allow `keys` to be undefined'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
7169c49
to
74fd899
Compare
@nunofgs I think the README is correct, but since the outcome might be different for a certain input value, I think publishing as 2.0.0 is enough. I agree with your comment regarding |
👍 |
LGTM |
74fd899
to
9a33251
Compare
Handle empty objects in `EqualKeys`
Closes #34.