Skip to content
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

Adds support for properties() #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

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