Skip to content

Conversation

@nathanmacinnes
Copy link
Contributor

This is something I'll find very useful. I've tried to make the tests illustrate the benefit, but in a bit more detail:

expect(fooBar).to.have.property("foo").which.is.an("object")
  .and.has.property("bar").which.is.a("function");

and this is the equivalent without .which:

expect(fooBar).to.have.property("foo");
expect(fooBar.foo).to.be.an("object")
  .and.to.have.property("bar");
expect(fooBar.foo.bar).to.be.a("function");

This allows the user to test properties more elegantly.

````
expect(myArray).to.have.property(0)
    .which.is.a(Foo)
    .and.has.own.property("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