tj / should.js

BDD style assertions for node.js -- test framework agnostic
MIT License
2.75k stars 195 forks source link

No way to test an array of properties non inclusively #113

Closed olalonde closed 11 years ago

olalonde commented 11 years ago

Would be nice to have should.have.keys(keys) but where keys is a non exhaustive list of keys. Right now, it fails if keys doesn't contain every single keys that the object has.

My workaround for now is:

['user', 'email', 'name'].forEach(function (property) {
  user.should.have.property(property);
});

Also - and maybe this should be a separate issue - why can't I chain this way?

user.should.have.property('username').and.have.property('email');
btd commented 11 years ago

in v2 will be properties(name1, name2,. ..)