Skip to content

Conversation

@ghusse
Copy link

@ghusse ghusse commented Sep 14, 2015

Adds support for `.properties()

It's really useful to partially test objects. I wish I could use it recently, when testing objects with a generated date as a property. I had to test properties one-by-one instead of using this single call.

Example:

expect({foo: bar, date: new Date()}).to.have.properties({foo: 'bar'});
expect({foo: bar, date: new Date()}).to.not.have.properties({foo: 'world'});

function Target(){
  this.hello = 'world';
}
Target.prototype.foo = 'bar';

expect(new Target()).to.have.own.properties({hello: 'world'});
expect(new Target()).to.not have.own.properties({hello: 'world', foo: 'bar'});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant